:root { --bg:#f7f8fc; --surface:#fff; --border:#e6e9f0; --text:#0f172a; --muted:#64748b; --accent:#10b981; }
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", Arial, sans-serif; background: var(--bg); color: var(--text); }
.layout { min-height: 100vh; display:grid; grid-template-columns:260px 1fr; transition:grid-template-columns .2s ease; }
.layout.collapsed { grid-template-columns:72px 1fr; }
.sidebar { background:var(--surface); border-right:1px solid var(--border); padding:12px 10px; overflow:hidden; }
.brand { display:flex; align-items:center; justify-content:space-between; margin:0 4px 12px; }
.brand-text { font-size:13px; font-weight:700; letter-spacing:.8px; color:#0b1324; }
.toggle { border:1px solid #cbd5e1; background:#fff; border-radius:8px; width:30px; height:30px; cursor:pointer; }
.section-title { margin:10px 6px 6px; font-size:11px; color:#6b7280; text-transform:uppercase; letter-spacing:.8px; }
.menu-item { display:flex; align-items:center; gap:8px; text-decoration:none; color:#1f2937; padding:8px; border-radius:10px; border:1px solid transparent; font-size:13px; white-space:nowrap; }
.menu-item:hover { background:#f8fafc; border-color:#dbe2ea; }
.menu-item.active { background:#ecfdf5; border-color:#a7f3d0; color:#065f46; font-weight:600; }
.icon { width:16px; height:16px; flex:0 0 16px; }
.icon svg { width:100%; height:100%; stroke:currentColor; fill:none; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
.layout.collapsed .brand-text, .layout.collapsed .section-title, .layout.collapsed .label { display:none; }
.content { padding:12px; }
.panel { background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:14px; height:calc(100vh - 24px); display:flex; flex-direction:column; }
.topbar { display:flex; justify-content:space-between; gap:10px; align-items:center; margin-bottom:10px; flex-wrap:wrap; }
h1 { margin:0; font-size:22px; }
.sub { margin:4px 0 0; color:var(--muted); font-size:13px; }
.actions { display:flex; gap:8px; flex-wrap:wrap; }
.btn { border:1px solid #cbd5e1; background:#fff; border-radius:8px; padding:7px 10px; font-size:13px; cursor:pointer; }
.btn.primary { background:var(--accent); border-color:#059669; color:#fff; }
.btn.danger { background:#ef4444; border-color:#dc2626; color:#fff; }
.btn:disabled { opacity:.45; cursor:not-allowed; }
.search-input { border:1px solid #cbd5e1; border-radius:8px; padding:7px 10px; font-size:13px; width:200px; }
.search-input:focus { outline:none; border-color:#10b981; box-shadow:0 0 0 2px rgba(16,185,129,.2); }
th.sortable { cursor:pointer; user-select:none; }
th.sortable:hover { background:#e2e8f0; }
th.sortable span { display:inline-flex; align-items:center; gap:4px; }
th.sortable span::after { content:'↕'; opacity:.3; font-size:10px; }
th.sort-asc span::after { content:'↑'; opacity:1; color:#10b981; }
th.sort-desc span::after { content:'↓'; opacity:1; color:#10b981; }
.table-wrap { flex:1; min-height:0; overflow:auto; border:1px solid var(--border); border-radius:10px; background:#fff; }
table { width:100%; border-collapse:collapse; }
th, td { border-bottom:1px solid var(--border); text-align:left; padding:8px 7px; font-size:13px; }
th { color:#334155; background:#f8fafc; font-weight:600; position:sticky; top:0; z-index:1; }
tr.selected td { background:#bfdbfe !important; }
tr[data-id]:hover td { background:#f8fafc; cursor:pointer; }
.overlay { display:none; position:fixed; inset:0; background:rgba(15,23,42,.45); z-index:100; align-items:center; justify-content:center; }
.overlay.open { display:flex; }
.modal { background:var(--surface); border:1px solid var(--border); border-radius:14px; width:560px; max-width:96vw; max-height:90vh; display:flex; flex-direction:column; }
.modal-head { display:flex; justify-content:space-between; align-items:center; padding:14px 16px; border-bottom:1px solid var(--border); }
.modal-head h2 { margin:0; font-size:16px; }
.modal-close { background:none; border:none; font-size:20px; cursor:pointer; color:var(--muted); line-height:1; }
.modal-body { padding:16px; overflow-y:auto; flex:1; }
.modal-foot { padding:12px 16px; border-top:1px solid var(--border); display:flex; gap:8px; justify-content:flex-end; align-items:center; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.form-group { display:flex; flex-direction:column; gap:4px; margin-bottom:10px; }
.form-group label { font-size:12px; font-weight:600; color:#334155; }
.form-group input { border:1px solid #cbd5e1; border-radius:7px; padding:6px 8px; font-size:13px; color:var(--text); background:#fff; width:100%; }
.form-group input:disabled { background:#f1f5f9; color:var(--muted); }
.form-group select { border:1px solid #cbd5e1; border-radius:7px; padding:6px 8px; font-size:13px; color:var(--text); background:#fff; width:100%; }
.check-row { display:flex; align-items:center; gap:8px; padding-top:4px; }
.check-row input[type=checkbox] { width:16px; height:16px; }
@media (max-width:920px){ .layout,.layout.collapsed{grid-template-columns:1fr;} .sidebar{border-right:0;border-bottom:1px solid var(--border);} .panel{height:auto;} .layout.collapsed .brand-text,.layout.collapsed .section-title,.layout.collapsed .label{display:initial;} .form-row{grid-template-columns:1fr;} }
#toast { position:fixed; bottom:24px; left:50%; transform:translateX(-50%) translateY(20px); background:#1e293b; color:#fff; padding:10px 20px; border-radius:10px; font-size:13px; opacity:0; pointer-events:none; transition:opacity .25s,transform .25s; z-index:200; max-width:420px; text-align:center; box-shadow:0 4px 16px rgba(0,0,0,.25); }
#toast.show { opacity:1; transform:translateX(-50%) translateY(0); }
#toast.toast-error { background:#dc2626; }
#toast.toast-ok    { background:#16a34a; }
