:root { --bg:#f9fafb; --card:#fff; --text:#111827; --muted:#6b7280; --line:#e5e7eb; --accent:#4f46e5; --accent-soft:#e0e7ff; --accent-dark:#4338ca;
  --green:#15803d; --green-bg:#dcfce7; --red:#b91c1c; --red-bg:#fee2e2; --blue:#1d4ed8; --blue-bg:#dbeafe; --amber:#b45309; --amber-bg:#fef3c7; --gray-bg:#f3f4f6; }
* { box-sizing:border-box; }
html,body { margin:0; background:var(--bg); color:var(--text); font:14px/1.45 -apple-system,BlinkMacSystemFont,"Inter","Segoe UI",sans-serif; color-scheme:light; }
[hidden] { display:none !important; }
h1,h2,h3 { margin:0; font-weight:600; }
.muted { color:var(--muted); } .err { color:var(--red); min-height:1.4em; margin:8px 0 0; } .small { font-size:12px; }
button { font:inherit; cursor:pointer; }
input, select, textarea { font:inherit; font-size:14px; color:var(--text); background:#fff; border:1px solid var(--line); border-radius:8px; padding:8px 10px; width:100%; caret-color:var(--text); }
input:focus, select:focus, textarea:focus { outline:2px solid var(--accent-soft); border-color:var(--accent); }
textarea { resize:vertical; min-height:60px; }
input:-webkit-autofill { -webkit-text-fill-color:var(--text); box-shadow:0 0 0 1000px #fff inset; }
label { display:block; font-size:12px; font-weight:500; color:var(--muted); margin:0 0 4px; }

/* buttons */
.btn { display:inline-flex; align-items:center; gap:6px; padding:8px 14px; border-radius:8px; border:1px solid var(--line); background:#fff; color:var(--text); font-weight:500; white-space:nowrap; }
.btn:hover { border-color:#c7c9d1; background:#fafafa; }
.btn.primary { background:var(--accent); border-color:var(--accent); color:#fff; } .btn.primary:hover { background:var(--accent-dark); }
.btn.warn { background:#fffbeb; border-color:#fcd34d; color:var(--amber); }
.btn.block { width:100%; justify-content:center; margin-top:14px; }
.btn.sm { padding:5px 10px; font-size:13px; }
.link { background:none; border:0; color:var(--muted); padding:4px 8px; }
.icon-btn { background:none; border:0; padding:6px; border-radius:6px; color:#374151; display:inline-flex; } .icon-btn:hover { background:var(--gray-bg); }
.icon-btn.del { color:#ef4444; } .icon-btn.off { opacity:.3; pointer-events:none; }
svg.i { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; flex:none; }

/* login */
#login { min-height:100vh; display:grid; place-items:center; padding:20px; }
.login-card { width:100%; max-width:360px; background:#fff; border:1px solid var(--line); border-radius:14px; padding:28px; box-shadow:0 10px 30px rgba(17,24,39,.06); }
.brand { font:600 28px Georgia,serif; letter-spacing:.22em; }
.login-card form { margin-top:18px; } .login-card label { margin-top:12px; }
.pw { position:relative; } .pw input { padding-right:60px; } .pw .link { position:absolute; right:2px; top:3px; }

/* shell */
#app { display:flex; min-height:100vh; }
aside { width:250px; flex:none; background:#fff; border-right:1px solid var(--line); padding:16px 14px; position:sticky; top:0; height:100vh; overflow:auto; display:flex; flex-direction:column; }
aside .label { font-size:12px; color:var(--muted); padding:0 6px; margin:4px 0; }
aside .site { border:1px solid var(--line); border-radius:10px; padding:6px; margin-bottom:18px; }
aside .site div { padding:8px 10px; border-radius:8px; font-weight:500; }
aside .site .on { background:var(--accent); color:#fff; }
aside nav { flex:1; }
aside .group { font-size:11px; text-transform:uppercase; letter-spacing:.06em; color:#9ca3af; padding:14px 10px 4px; }
aside a { display:flex; align-items:center; gap:12px; padding:9px 10px; border-radius:8px; color:#374151; cursor:pointer; text-decoration:none; border-left:3px solid transparent; }
aside a:hover { background:var(--gray-bg); }
aside a.on { background:var(--accent-soft); color:var(--accent); border-left-color:var(--accent); font-weight:500; }
aside .logout { border-top:1px solid var(--line); margin-top:10px; padding-top:10px; }
main { flex:1; min-width:0; padding:22px 28px 90px; }
.page-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; flex-wrap:wrap; margin-bottom:16px; }
.page-head h1 { font-size:22px; } .page-head p { margin:2px 0 0; }

/* toolbar & filters */
.toolbar { display:flex; gap:20px; align-items:flex-end; flex-wrap:wrap; margin-bottom:14px; }
.search { position:relative; width:320px; max-width:100%; } .search svg { position:absolute; left:11px; top:50%; transform:translateY(-50%); color:var(--muted); }
.search input { padding-left:36px; height:38px; }
.filter .t { font-size:12px; color:var(--muted); margin-bottom:4px; }
.seg { display:inline-flex; border:1px solid var(--line); border-radius:8px; overflow:hidden; background:#fff; }
.seg button { border:0; background:#fff; padding:6px 12px; color:#374151; border-right:1px solid var(--line); } .seg button:last-child { border-right:0; }
.seg button.on { background:var(--accent); color:#fff; }
.spacer { flex:1; }

/* table */
.table-wrap { background:#fff; border:1px solid var(--line); border-radius:10px; overflow:auto; }
table { width:100%; border-collapse:collapse; }
th { text-align:left; font-weight:500; padding:12px 14px; background:#f9fafb; border-bottom:1px solid var(--line); white-space:nowrap; }
td { padding:11px 14px; border-bottom:1px solid #f0f1f3; vertical-align:middle; }
tr:last-child td { border-bottom:0; } tbody tr:hover { background:#fafbff; }
td.actions { white-space:nowrap; text-align:right; } .empty { padding:40px; text-align:center; color:var(--muted); }
.person { display:flex; align-items:center; gap:12px; cursor:pointer; } .person b { font-weight:500; }
.avatar { width:40px; height:40px; border-radius:50%; object-fit:cover; background:var(--gray-bg); flex:none; border:1px solid var(--line); }
.thumb { width:44px; height:44px; border-radius:8px; object-fit:cover; background:var(--gray-bg); border:1px solid var(--line); }
.chip { display:inline-block; padding:2px 8px; border-radius:6px; font-size:12px; background:var(--gray-bg); color:#4b5563; }
.chip.green { background:var(--green-bg); color:var(--green); } .chip.red { background:var(--red-bg); color:var(--red); }
.chip.blue { background:var(--blue-bg); color:var(--blue); } .chip.amber { background:var(--amber-bg); color:var(--amber); }
button.chip { border:0; cursor:pointer; }

/* cards / forms */
.card { background:#fff; border:1px solid var(--line); border-radius:10px; padding:18px; margin-bottom:16px; }
.card h3 { font-size:15px; margin-bottom:12px; }
.grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:12px; }
.grid.two { grid-template-columns:1fr 1fr; } .field.wide { grid-column:1/-1; }
.hint { font-size:12px; color:var(--muted); margin-top:3px; }
.pills { display:flex; flex-wrap:wrap; gap:6px; }
.pill { border:1px solid var(--line); background:#fff; border-radius:999px; padding:5px 12px; color:#374151; }
.pill.on { background:var(--accent); border-color:var(--accent); color:#fff; }
.thumbs { display:flex; gap:8px; flex-wrap:wrap; margin-top:8px; } .thumbs .t { position:relative; }
.thumbs img { width:64px; height:80px; object-fit:cover; border-radius:8px; border:1px solid var(--line); background:var(--gray-bg); }
.thumbs .t span { position:absolute; left:3px; bottom:3px; font-size:10px; background:var(--accent); color:#fff; border-radius:4px; padding:0 4px; }
.art { display:grid; grid-template-columns:84px 1fr auto; gap:14px; padding:14px; border:1px solid var(--line); border-radius:10px; margin-bottom:10px; background:#fcfcfd; }
.art img { width:84px; height:84px; object-fit:cover; border-radius:8px; background:var(--gray-bg); border:1px solid var(--line); }
.art .fields { display:grid; grid-template-columns:200px 1fr; gap:10px; } .art .fields .wide { grid-column:1/-1; }
.art .ctl { display:flex; flex-direction:column; gap:2px; }
.sticky-bar { position:fixed; left:250px; right:0; bottom:0; background:#fff; border-top:1px solid var(--line); padding:12px 28px; display:flex; gap:10px; align-items:center; z-index:5; }
.switch { display:inline-flex; align-items:center; gap:8px; cursor:pointer; user-select:none; margin:0; font-size:14px; color:var(--text); } .switch input { width:auto; }
.stats { display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:12px; margin-bottom:20px; }
.stat { background:#fff; border:1px solid var(--line); border-radius:10px; padding:14px; cursor:pointer; } .stat b { display:block; font-size:26px; font-weight:600; }

/* modal & toast */
.modal-bg { position:fixed; inset:0; background:rgba(17,24,39,.45); display:grid; place-items:center; padding:20px; z-index:20; }
.modal { background:#fff; border-radius:12px; width:100%; max-width:520px; max-height:90vh; overflow:auto; padding:22px; }
.modal h2 { font-size:18px; margin-bottom:14px; } .modal .field { margin-bottom:12px; } .modal .foot { display:flex; justify-content:flex-end; gap:8px; margin-top:16px; }
#toast { position:fixed; right:20px; bottom:20px; background:#111827; color:#fff; padding:10px 16px; border-radius:8px; opacity:0; transform:translateY(8px); transition:.2s; pointer-events:none; z-index:50; }
#toast.show { opacity:1; transform:none; } #toast.err { background:var(--red); }
iframe { width:100%; height:calc(100vh - 150px); border:1px solid var(--line); border-radius:10px; background:#fff; }
@media (max-width:860px){ #app{flex-direction:column} aside{position:static;width:auto;height:auto} .sticky-bar{left:0} .grid.two,.art .fields{grid-template-columns:1fr} .art{grid-template-columns:1fr} }
