/* DearSoft ERP (Python) - Shopify-easy, deliberately not Shopify's skin.
   Palette: deep navy + mint + warm sand. Phone first (360px). */
:root {
    --navy: #0b1220;
    --navy-2: #131c2e;
    --mint: #2dd4a7;
    --mint-dark: #17a580;
    --sand: #f6f3ec;
    --ink: #10131a;
    --muted: #68727f;
    --line: #e7e1d6;
    --card: #ffffff;
    --danger: #d94a4a;
    --warn: #e0a106;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(16, 19, 26, .04), 0 12px 28px rgba(16, 19, 26, .06);
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --display: 'Manrope', 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    color: var(--ink);
    background: var(--sand);
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}
a { color: var(--mint-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--display); letter-spacing: -.02em; margin: 0; }
input, button, select, textarea { font: inherit; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }
.hide-sm { display: initial; }

/* ---------- app shell ---------- */
.app { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
/* the sidebar backdrop is a phone-only overlay; without this it becomes a grid
   item on desktop and pushes .main into the 248px sidebar column */
.backdrop { display: none; }
.sidebar {
    background: var(--navy);
    color: #c9d2dc;
    padding: 18px 14px 28px;
    display: flex; flex-direction: column; gap: 18px;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 10px; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 11px;
    background: linear-gradient(135deg, var(--mint), #7ef0cf);
    color: #08312a; display: grid; place-items: center;
    font: 800 15px var(--display);
}
.brand-name { color: #fff; font: 700 15px var(--display); }
.brand-sub { color: #7d8997; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.nav-label { color: #5f6b7a; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; padding: 8px 10px 4px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
    display: flex; align-items: center; gap: 10px;
    color: #b9c4d0; padding: 9px 10px; border-radius: 10px;
    font-size: 14px; text-decoration: none;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav a.on { background: rgba(45,212,167,.14); color: #c8fff0; }
.nav a .ico { width: 18px; text-align: center; opacity: .9; }
.nav a .old { margin-left: auto; font-size: 9px; letter-spacing: .06em; text-transform: uppercase; color: #6b7787; border: 1px solid #2a3547; padding: 2px 5px; border-radius: 5px; }
.side-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.08); padding-top: 12px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: rgba(45,212,167,.18); color: var(--mint); display: grid; place-items: center; font-weight: 700; }
.side-user .n { color: #e8eef4; font-size: 13px; font-weight: 600; }
.side-user .r { color: #77838f; font-size: 11px; text-transform: capitalize; }
.logout-link { color: #8b97a4; font-size: 12px; }
.logout-link:hover { color: #fff; text-decoration: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 14px;
    padding: 12px 22px;
    background: rgba(246,243,236,.88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 19px; font-weight: 800; }
.topbar .spacer { flex: 1; }
.searchbar { position: relative; flex: 1; max-width: 420px; }
.searchbar input {
    width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 11px;
    background: var(--card); padding: 0 12px 0 36px; font-size: 14px;
}
.searchbar input:focus { outline: none; border-color: var(--mint-dark); box-shadow: 0 0 0 3px rgba(45,212,167,.18); }
.searchbar .s-ico { position: absolute; left: 12px; top: 11px; color: var(--muted); }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--card); }
.lang-switch button { border: 0; background: transparent; padding: 7px 10px; cursor: pointer; font-size: 12px; color: var(--muted); }
.lang-switch button.on { background: var(--navy); color: #fff; }
.content { padding: 22px; max-width: 1200px; width: 100%; margin: 0 auto; }

/* ---------- cards / grid ---------- */
.grid { display: grid; gap: 14px; }
.grid.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.k2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .h { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card .h h2 { font-size: 15px; font-weight: 800; }
.card .b { padding: 16px 18px; }
.kpi { padding: 16px 18px; }
.kpi .lbl { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.kpi .val { font: 800 26px var(--display); margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.kpi.accent { background: linear-gradient(135deg, var(--navy), #172338); border-color: #172338; color: #fff; }
.kpi.accent .lbl, .kpi.accent .sub { color: #93a0b0; }
.kpi.accent .val { color: var(--mint); }

.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; font-size: 14px; font-weight: 600; text-decoration: none; }
.btn:hover { text-decoration: none; }
.btn.primary { background: var(--mint); color: #06322a; }
.btn.primary:hover { background: #46e3b9; }
.btn.ghost { background: var(--card); border-color: var(--line); color: var(--ink); }
.btn.dark { background: var(--navy); color: #fff; }
.btn.block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; background: #eef4f1; color: #23624f; }
.chip.warn { background: #fdf4dc; color: #8a6100; }
.chip.bad { background: #fdeaea; color: #a22e2e; }
.chip.mut { background: #f0eee8; color: #6b6459; }

table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.list td { padding: 12px; border-bottom: 1px solid #f1ede4; font-size: 14px; }
table.list tr:last-child td { border-bottom: 0; }
table.list .num { text-align: right; font-variant-numeric: tabular-nums; }

.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .big { font-size: 30px; margin-bottom: 8px; }

/* ---------- forms / auth ---------- */
label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 6px; }
.field { margin-bottom: 14px; }
.field input { width: 100%; height: 46px; border: 1.4px solid var(--line); border-radius: 11px; background: var(--card); padding: 0 13px; font-size: 15px; }
.field input:focus { outline: none; border-color: var(--mint-dark); box-shadow: 0 0 0 3px rgba(45,212,167,.18); }
.help { color: var(--muted); font-size: 12px; margin-top: 6px; }
.alert { border-radius: 11px; padding: 11px 14px; font-size: 14px; margin-bottom: 14px; }
.alert.ok { background: #e9f9f2; border: 1px solid #bfe9d9; color: #11624b; }
.alert.err { background: #fdeeee; border: 1px solid #f5c9c9; color: #9d2b2b; }

.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.auth-brand {
    background: radial-gradient(900px 500px at 20% 0%, rgba(45,212,167,.24), transparent 60%), var(--navy);
    color: #fff; padding: 46px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-brand h2 { font-size: 34px; line-height: 1.15; max-width: 460px; }
.auth-brand p { color: #a9b4c1; max-width: 440px; }
.auth-points { display: grid; gap: 12px; margin-top: 22px; }
.auth-points div { display: flex; gap: 10px; align-items: flex-start; color: #cdd6df; font-size: 14px; }
.auth-points .dot { width: 22px; height: 22px; border-radius: 7px; background: rgba(45,212,167,.18); color: var(--mint); display: grid; place-items: center; font-size: 12px; flex: 0 0 auto; }
.auth-side { display: flex; align-items: center; justify-content: center; padding: 32px 18px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-card .sub { color: var(--muted); margin-bottom: 22px; }
.auth-foot { margin-top: 18px; font-size: 13px; color: var(--muted); text-align: center; }
.wa-box { margin-top: 18px; border: 1px dashed #bfe9d9; background: #f3fbf7; border-radius: 12px; padding: 13px 14px; font-size: 13px; color: #22604d; }
.wa-box a { font-weight: 700; }

/* ---------- licence ---------- */
.lic-card { padding: 18px; }
.lic-card .dom { font: 800 17px var(--display); word-break: break-all; }
.lic-card .prod { color: var(--muted); font-size: 13px; margin-top: 2px; }
.lic-card .feat { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.lic-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; font-size: 12px; color: var(--muted); }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; min-width: 180px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 14px; font-size: 13px; }
.pager a, .pager span { padding: 7px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); }
.pager .cur { background: var(--navy); color: #fff; border-color: var(--navy); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid textarea { width: 100%; min-height: 90px; border: 1.4px solid var(--line); border-radius: 11px; padding: 10px 12px; background: var(--card); }
.form-grid select { width: 100%; height: 46px; border: 1.4px solid var(--line); border-radius: 11px; padding: 0 10px; background: var(--card); }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 14px; padding-top: 8px; }
.checkline input { width: 18px; height: 18px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------- bottom nav (phone) ---------- */
.bottom-nav { display: none; }
@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; inset: 0 auto 0 0; width: 268px; z-index: 60;
        transform: translateX(-102%); transition: transform .18s ease;
    }
    .sidebar.open { transform: translateX(0); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
    .backdrop { display: none; position: fixed; inset: 0; background: rgba(11,18,32,.45); z-index: 50; }
    .backdrop.show { display: block; }
    .topbar { padding: 10px 14px; gap: 10px; flex-wrap: wrap; }
    .topbar h1 { font-size: 17px; }
    .menu-btn { display: inline-grid !important; }
    .searchbar { order: 3; flex: 0 0 100%; max-width: none; }
    .content { padding: 14px 12px 96px; }
    .grid.k4, .grid.k3, .grid.k2 { grid-template-columns: 1fr 1fr; }
    .bottom-nav {
        display: grid; grid-template-columns: repeat(5, 1fr);
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
        background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
        border-top: 1px solid var(--line);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    }
    .bottom-nav a, .bottom-nav button {
        display: flex; flex-direction: column; align-items: center; gap: 3px;
        font-size: 10.5px; color: var(--muted); background: none; border: 0;
        padding: 6px 2px; text-decoration: none; border-radius: 10px;
    }
    .bottom-nav a.on { color: var(--mint-dark); }
    .bottom-nav .bico { font-size: 17px; line-height: 1; }
    .bottom-nav .fab {
        margin-top: -22px; width: 52px; height: 52px; border-radius: 18px;
        background: var(--mint); color: #06322a; display: grid; place-items: center;
        font-size: 24px; box-shadow: 0 10px 24px rgba(45,212,167,.4);
        justify-self: center;
    }
    .hide-sm { display: none !important; }
    .auth { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    table.list { font-size: 13px; }
    table.list.compact th:nth-child(n+3), table.list.compact td:nth-child(n+3) { display: none; }
    .lic-card .dom { font-size: 15px; }
}
.menu-btn { display: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
@media (max-width: 430px) {
    .grid.k4, .grid.k3, .grid.k2 { grid-template-columns: 1fr; }
    .kpi .val { font-size: 23px; }
}
