* { box-sizing: border-box; }
html, body { margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background:#f5f7fa; color:#222; }
a { color:#2563eb; text-decoration:none; }
a:hover { text-decoration:underline; }

/* ---- Login ---- */
.login-page { background:linear-gradient(135deg,#1e3a8a,#2563eb); min-height:100vh; display:flex; align-items:center; justify-content:center; }
.login-box { background:#fff; padding:40px 36px; border-radius:12px; width:360px; box-shadow:0 20px 50px rgba(0,0,0,.2); }
.login-box h1 { margin:0; text-align:center; color:#1e3a8a; }
.login-box .muted { text-align:center; color:#666; margin:4px 0 24px; font-size:14px; }
.login-box label { display:block; font-size:13px; color:#555; margin:12px 0 4px; }
.login-box input { width:100%; padding:10px 12px; border:1px solid #d1d5db; border-radius:8px; font-size:14px; }
.login-box input:focus { outline:none; border-color:#2563eb; }
.login-box button { width:100%; margin-top:20px; padding:11px; background:#2563eb; color:#fff; border:none; border-radius:8px; font-size:15px; cursor:pointer; }
.login-box button:hover { background:#1d4ed8; }
.err { color:#dc2626; font-size:13px; margin-top:10px; min-height:18px; }

/* ---- App layout ---- */
.app { display:grid; grid-template-columns:230px 1fr; grid-template-rows:54px 1fr; grid-template-areas: "sb tb" "sb ct"; min-height:100vh; }
.sidebar { grid-area:sb; background:#1e293b; color:#e2e8f0; padding:14px 0; overflow-y:auto; }
.sidebar .brand { font-size:20px; font-weight:700; padding:0 18px 14px; border-bottom:1px solid #334155; }
.sidebar nav { padding:8px 0; }
.sidebar nav a { display:block; padding:8px 18px; color:#cbd5e1; font-size:14px; }
.sidebar nav a:hover, .sidebar nav a.active { background:#334155; color:#fff; text-decoration:none; }
.sidebar nav .grp { padding:12px 18px 4px; font-size:11px; text-transform:uppercase; color:#64748b; letter-spacing:.5px; }

.topbar { grid-area:tb; background:#fff; border-bottom:1px solid #e5e7eb; display:flex; align-items:center; padding:0 18px; gap:18px; }
.topbar .search input { width:300px; padding:7px 12px; border:1px solid #d1d5db; border-radius:6px; font-size:14px; }
.topbar .me { margin-left:auto; display:flex; gap:14px; align-items:center; font-size:14px; }

.content { grid-area:ct; padding:20px 24px; overflow-y:auto; }
.page-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; }
.page-head h1 { margin:0; font-size:22px; }

/* ---- KPI ---- */
.kpi-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:14px; }
.kpi { background:#fff; padding:18px; border-radius:10px; box-shadow:0 1px 3px rgba(0,0,0,.06); }
.kpi-val { font-size:22px; font-weight:700; color:#1e293b; }
.kpi-lbl { font-size:13px; color:#64748b; margin-top:4px; }

/* ---- Tables ---- */
table.list { width:100%; background:#fff; border-collapse:collapse; border-radius:10px; overflow:hidden; box-shadow:0 1px 3px rgba(0,0,0,.06); }
table.list th, table.list td { padding:10px 12px; text-align:left; border-bottom:1px solid #f1f5f9; font-size:14px; }
table.list th { background:#f8fafc; color:#64748b; font-weight:600; font-size:12px; text-transform:uppercase; }
table.list tr:hover td { background:#f8fafc; }

.btn { display:inline-block; padding:7px 14px; background:#2563eb; color:#fff; border-radius:6px; font-size:14px; border:none; cursor:pointer; }
.btn:hover { background:#1d4ed8; text-decoration:none; }
.btn:disabled { opacity:.6; cursor:default; }
.btn-sm { padding:4px 10px; font-size:13px; }
.btn-gray { background:#e5e7eb; color:#374151; }
.btn-gray:hover { background:#d1d5db; }
.btn-danger { background:#dc2626; }
.btn-danger:hover { background:#b91c1c; }
.btn-green { background:#16a34a; }
.btn-green:hover { background:#15803d; }

/* ---- Row actions ---- */
.row-act { display:flex; gap:6px; }
.ico-btn { border:none; background:none; cursor:pointer; font-size:14px; padding:3px 6px; border-radius:5px; color:#64748b; }
.ico-btn:hover { background:#f1f5f9; color:#1e293b; }
.ico-btn.del:hover { background:#fee2e2; color:#dc2626; }
.right { text-align:right !important; }
.muted { color:#94a3b8; }

/* ---- Badges ---- */
.badge { display:inline-block; padding:2px 9px; border-radius:999px; font-size:12px; font-weight:600; background:#e2e8f0; color:#475569; }
.badge.green { background:#dcfce7; color:#15803d; }
.badge.red { background:#fee2e2; color:#dc2626; }
.badge.amber { background:#fef3c7; color:#b45309; }
.badge.blue { background:#dbeafe; color:#1d4ed8; }
.badge.gray { background:#e5e7eb; color:#6b7280; }

/* ---- Filter bar ---- */
.filters { display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin-bottom:14px; background:#fff; padding:12px 14px; border-radius:10px; box-shadow:0 1px 3px rgba(0,0,0,.06); }
.filters input, .filters select { padding:7px 10px; border:1px solid #d1d5db; border-radius:6px; font-size:14px; }
.filters label { font-size:12px; color:#64748b; margin-right:2px; }

/* ---- Modal ---- */
.modal-back { position:fixed; inset:0; background:rgba(15,23,42,.45); display:flex; align-items:flex-start; justify-content:center; padding:40px 16px; z-index:1000; overflow-y:auto; }
.modal { background:#fff; border-radius:12px; width:100%; box-shadow:0 20px 60px rgba(0,0,0,.3); }
.modal-head { display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px solid #eef2f7; }
.modal-head h3 { margin:0; font-size:17px; }
.modal-x { border:none; background:none; font-size:24px; line-height:1; cursor:pointer; color:#94a3b8; }
.modal-x:hover { color:#1e293b; }
.modal-body { padding:18px 20px; }
.modal-foot { display:flex; justify-content:flex-end; gap:10px; margin-top:18px; }

/* ---- Forms ---- */
.grid-form { display:grid; grid-template-columns:1fr 1fr; gap:12px 16px; }
.form-row { display:flex; flex-direction:column; gap:4px; }
.form-row.col2 { grid-column:1 / -1; }
.form-row label { font-size:13px; color:#475569; font-weight:500; }
.form-row input, .form-row select, .form-row textarea { padding:8px 10px; border:1px solid #d1d5db; border-radius:7px; font-size:14px; font-family:inherit; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { outline:none; border-color:#2563eb; }
.form-row .chk { flex-direction:row; display:flex; align-items:center; gap:6px; font-size:14px; }
.form-err { color:#dc2626; font-size:13px; margin-top:12px; background:#fef2f2; border:1px solid #fecaca; padding:8px 12px; border-radius:7px; }

/* ---- Toast ---- */
.toast-box { position:fixed; top:16px; right:16px; z-index:2000; display:flex; flex-direction:column; gap:8px; }
.toast { min-width:220px; max-width:360px; padding:12px 16px; border-radius:9px; color:#fff; font-size:14px; box-shadow:0 8px 24px rgba(0,0,0,.2); opacity:0; transform:translateX(20px); transition:all .25s; }
.toast.show { opacity:1; transform:translateX(0); }
.toast-ok { background:#16a34a; }
.toast-err { background:#dc2626; }
.toast-info { background:#2563eb; }

/* ---- Document editor (qaimə sətirləri) ---- */
.doc-lines { width:100%; border-collapse:collapse; margin-top:8px; }
.doc-lines th, .doc-lines td { padding:6px 8px; font-size:13px; border-bottom:1px solid #f1f5f9; text-align:left; }
.doc-lines th { color:#64748b; font-weight:600; font-size:11px; text-transform:uppercase; }
.doc-lines input, .doc-lines select { width:100%; padding:6px 8px; border:1px solid #d1d5db; border-radius:6px; font-size:13px; }
.doc-lines .num { width:90px; }
.doc-total { text-align:right; font-size:16px; font-weight:700; margin-top:12px; }
.summary-cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:12px; margin-bottom:18px; }
.summary-cards .kpi-val { font-size:20px; }
.tabs { display:flex; gap:6px; margin-bottom:16px; flex-wrap:wrap; }
.tabs button { padding:7px 14px; border:1px solid #d1d5db; background:#fff; border-radius:7px; cursor:pointer; font-size:14px; color:#475569; }
.tabs button.active { background:#2563eb; color:#fff; border-color:#2563eb; }

@media (max-width:640px){ .grid-form{ grid-template-columns:1fr; } .app{ grid-template-columns:1fr; grid-template-areas:"tb" "ct"; } .sidebar{ display:none; } }
