/* =========================================================
   Morada Admin — design system
   ========================================================= */
:root {
    /* Superfícies e texto */
    --bg: #eef2f7;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --ink: #0f172a;
    --ink-2: #334155;
    --muted: #64748b;
    --line: #e6ebf2;

    /* Marca (verde imobiliária) */
    --brand: #6a86c9;
    --brand-600: #5e7bc0;
    --brand-700: #3f5591;
    --brand-soft: #eaeffa;

    /* Acentos semânticos */
    --danger: #dc2626;  --danger-soft: #fdecef;
    --warn:   #d97706;  --warn-soft:   #fdf3e3;
    --info:   #2563eb;  --info-soft:   #e9f0fe;
    --violet: #7c3aed;  --violet-soft: #f0eafd;

    /* Formas */
    --radius: 16px;
    --radius-sm: 11px;
    --radius-xs: 8px;

    /* Sombras */
    --shadow-xs: 0 1px 2px rgba(15,23,42,.06);
    --shadow-sm: 0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
    --shadow-md: 0 6px 18px rgba(15,23,42,.08);
    --shadow-lg: 0 24px 48px -12px rgba(15,23,42,.24);

    --sidebar-w: 272px;
    --topbar-h: 72px;

    --ease: cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: "Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; }

.icon { width: 20px; height: 20px; flex-shrink: 0; }

/* =========================================================
   Shell
   ========================================================= */
.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    color: rgba(255,255,255,.82);
    background:
        radial-gradient(120% 55% at 100% 0%, rgba(255,255,255,.14) 0%, rgba(255,255,255,0) 55%),
        linear-gradient(180deg, #7690d0 0%, #6a86c9 55%, #5f7bc1 100%);
    border-right: 1px solid rgba(255,255,255,.14);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 8px 22px;
}
.brand-mark {
    display: grid;
    place-items: center;
    width: 40px; height: 40px;
    border-radius: 12px;
    color: var(--brand);
    background: #ffffff;
    box-shadow: 0 6px 16px rgba(38,54,95,.28);
}
.brand-mark .icon { width: 22px; height: 22px; }
.brand-text { font-size: 18px; font-weight: 700; color: #fff; letter-spacing: -.2px; }
.brand-text b { font-weight: 700; color: #cdd9f5; margin-left: 1px; }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-section {
    font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
    color: rgba(255,255,255,.55); padding: 16px 12px 8px;
}
.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: rgba(255,255,255,.82);
    text-decoration: none;
    transition: background .16s var(--ease), color .16s var(--ease);
}
.nav-link .icon { width: 19px; height: 19px; color: rgba(255,255,255,.65); transition: color .16s var(--ease); }
.nav-link:not(.disabled):hover { background: rgba(255,255,255,.14); color: #fff; }
.nav-link:not(.disabled):hover .icon { color: #fff; }
.nav-link.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(255,255,255,.2) 0%, rgba(255,255,255,.04) 100%);
}
.nav-link.active .icon { color: #fff; }
.nav-link.active::before {
    content: "";
    position: absolute; left: -16px; top: 50%; transform: translateY(-50%);
    width: 4px; height: 22px; border-radius: 0 4px 4px 0;
    background: #fff;
}
.nav-link.disabled { color: rgba(255,255,255,.45); cursor: default; }
.nav-link.disabled .icon { color: rgba(255,255,255,.3); }
.nav-link .soon {
    margin-left: auto;
    font-size: 10px; font-weight: 600; font-style: normal; letter-spacing: .04em;
    text-transform: uppercase;
    color: rgba(255,255,255,.8);
    background: rgba(255,255,255,.15);
    padding: 3px 7px; border-radius: 999px;
}

.sidebar-foot { padding-top: 14px; border-top: 1px solid rgba(255,255,255,.18); }
.mini-user { display: flex; align-items: center; gap: 11px; padding: 8px; }
.mini-user .avatar { width: 38px; height: 38px; font-size: 13px; box-shadow: 0 0 0 1px rgba(255,255,255,.4); }
.mini-user-info { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.mini-user-info strong { font-size: 13px; color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-user-info span { font-size: 11px; color: rgba(255,255,255,.65); text-transform: capitalize; }

/* ---------- Avatar ---------- */
.avatar {
    display: grid; place-items: center;
    border-radius: 50%;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(140deg, var(--brand) 0%, var(--brand-700) 100%);
    flex-shrink: 0;
}

/* ---------- Main ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
    height: var(--topbar-h);
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 30px;
    background: rgba(255,255,255,.85);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
}
.topbar-title h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.3px; }
.topbar-title .crumb { font-size: 12px; color: var(--muted); font-weight: 500; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.user-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 8px 6px 6px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
}
.user-chip .avatar { width: 34px; height: 34px; font-size: 12px; }
.user-chip-name { font-size: 13px; font-weight: 600; }
.user-chip-name small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; text-transform: capitalize; }

.content { padding: 30px; max-width: 1240px; width: 100%; }

/* =========================================================
   Botões
   ========================================================= */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: linear-gradient(140deg, var(--brand) 0%, var(--brand-600) 100%);
    color: #fff; border: 0;
    border-radius: var(--radius-sm);
    padding: 12px 18px;
    font-family: inherit; font-size: 14px; font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(106,134,201,.35);
    transition: transform .12s var(--ease), box-shadow .16s var(--ease), filter .16s var(--ease);
}
.btn:hover { filter: brightness(1.05); box-shadow: 0 8px 22px rgba(106,134,201,.45); }
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; }
.btn .icon { width: 18px; height: 18px; }

.btn-ghost {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-2);
    text-decoration: none;
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    transition: background .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); border-color: #d5dde7; }
.btn-ghost .icon { width: 17px; height: 17px; color: var(--muted); }

.icon-btn {
    display: grid; place-items: center;
    width: 40px; height: 40px;
    border-radius: 11px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    transition: background .16s var(--ease), color .16s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

/* =========================================================
   Page header
   ========================================================= */
.page-head { margin-bottom: 24px; }
.page-head h2 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

/* =========================================================
   Stat cards
   ========================================================= */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 24px; }
.stat {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat::after {
    content: ""; position: absolute; right: -30px; top: -30px;
    width: 120px; height: 120px; border-radius: 50%;
    background: radial-gradient(circle, var(--tint, var(--brand-soft)) 0%, transparent 70%);
    opacity: .6;
}
.stat-badge {
    display: grid; place-items: center;
    width: 46px; height: 46px; border-radius: 13px;
    margin-bottom: 16px;
    color: var(--accent, var(--brand));
    background: var(--tint, var(--brand-soft));
}
.stat-badge .icon { width: 23px; height: 23px; }
.stat-value { font-size: 30px; font-weight: 800; letter-spacing: -.6px; line-height: 1; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 6px; font-weight: 500; }
.stat-delta { display: inline-flex; align-items: center; gap: 4px; margin-top: 12px; font-size: 12px; font-weight: 600; color: var(--brand-700); }
.stat-delta .icon { width: 14px; height: 14px; }

.stat.t-brand  { --tint: var(--brand-soft);  --accent: var(--brand); }
.stat.t-info   { --tint: var(--info-soft);   --accent: var(--info); }
.stat.t-violet { --tint: var(--violet-soft); --accent: var(--violet); }
.stat.t-warn   { --tint: var(--warn-soft);   --accent: var(--warn); }

/* =========================================================
   Panels / grid
   ========================================================= */
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.panel-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.panel-head .icon { width: 19px; height: 19px; color: var(--brand); }
.panel-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.panel-body { padding: 20px 22px; }
.panel-body p { margin: 0 0 12px; color: var(--ink-2); font-size: 14px; line-height: 1.6; }
.panel-body p:last-child { margin-bottom: 0; }

/* ---------- Roadmap / steps ---------- */
.steps { display: flex; flex-direction: column; gap: 2px; }
.step { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.step-dot {
    display: grid; place-items: center;
    width: 30px; height: 30px; border-radius: 50%;
    font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.step-dot .icon { width: 16px; height: 16px; }
.step.done .step-dot { background: var(--brand-soft); color: var(--brand); }
.step.doing .step-dot { background: var(--info-soft); color: var(--info); }
.step.todo .step-dot { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.step-body { flex: 1; }
.step-title { font-size: 14px; font-weight: 600; }
.step-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.chip { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.chip.done { background: var(--brand-soft); color: var(--brand-700); }
.chip.doing { background: var(--info-soft); color: var(--info); }
.chip.todo { background: var(--surface-2); color: var(--muted); }

/* Distribuição (painel) */
.dist-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 10px; }
.dist-item { margin-bottom: 12px; }
.dist-item:last-child { margin-bottom: 0; }
.dist-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 13.5px; margin-bottom: 5px; }
.dist-top strong { font-weight: 600; color: var(--ink); }
.dist-top .v { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.dist-bar { height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.dist-bar > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

/* =========================================================
   Alertas
   ========================================================= */
.alert {
    display: flex; align-items: center; gap: 10px;
    padding: 13px 16px; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500; margin-bottom: 18px;
    border: 1px solid transparent;
}
.alert .icon { width: 18px; height: 18px; flex-shrink: 0; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: #f7d4da; }
.alert-success { background: #e7f4ec; color: #0a6b3d; border-color: #c7ead6; }

/* =========================================================
   Formulários
   ========================================================= */
.form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .icon { position: absolute; left: 13px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.input-group input {
    width: 100%;
    padding: 13px 14px 13px 42px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: inherit; font-size: 15px; color: var(--ink);
    background: var(--surface-2);
    transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
}
.input-group input::placeholder { color: #9aa6b4; }
.input-group input:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(106,134,201,.22);
}

/* =========================================================
   Login (split-screen)
   ========================================================= */
.auth-body { display: block; }
.auth-wrap { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }

.auth-brandside {
    position: relative;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 48px;
    color: rgba(255,255,255,.85);
    overflow: hidden;
    background:
        radial-gradient(90% 60% at 12% 12%, rgba(255,255,255,.18) 0%, rgba(255,255,255,0) 60%),
        radial-gradient(70% 50% at 90% 92%, rgba(30,44,82,.30) 0%, rgba(30,44,82,0) 60%),
        linear-gradient(160deg, #6a86c9 0%, #5f7bc1 45%, #4d669f 100%);
    border-right: 1px solid rgba(255,255,255,.12);
}
.auth-brandside::before {
    content: "";
    position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255,255,255,.12) 1px, transparent 1px);
    background-size: 22px 22px;
    mask-image: radial-gradient(120% 80% at 30% 20%, #000 0%, transparent 75%);
}
.auth-brandside > * { position: relative; z-index: 1; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand .brand-mark { width: 44px; height: 44px; }
.auth-brand .brand-text { font-size: 20px; }
.auth-hero { max-width: 400px; }
.auth-hero .kicker {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 12px; font-weight: 600; letter-spacing: .04em;
    color: #fff; text-transform: uppercase;
    background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28);
    padding: 6px 12px; border-radius: 999px; margin-bottom: 22px;
}
.auth-hero .kicker .icon { width: 15px; height: 15px; }
.auth-hero h2 { margin: 0; font-size: 38px; line-height: 1.1; font-weight: 800; letter-spacing: -1px; color: #fff; }
.auth-hero p { margin: 16px 0 0; font-size: 15px; line-height: 1.7; color: rgba(255,255,255,.82); }
.auth-features { display: flex; flex-direction: column; gap: 14px; margin-top: 32px; }
.auth-feature { display: flex; align-items: center; gap: 12px; font-size: 14px; color: rgba(255,255,255,.85); }
.auth-feature .tick { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: rgba(255,255,255,.18); color: #fff; }
.auth-feature .tick .icon { width: 15px; height: 15px; }
.auth-foot { font-size: 12px; color: rgba(255,255,255,.65); }

.auth-formside { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--surface); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .brand.center { display: none; }
.auth-card h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.auth-card .sub { margin: 8px 0 28px; color: var(--muted); font-size: 14px; }
.auth-card form { margin-top: 4px; }

/* =========================================================
   Toolbar / tabela / paginação
   ========================================================= */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.toolbar .search { position: relative; flex: 1; min-width: 220px; }
.toolbar .search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); }
.toolbar .search input { width: 100%; padding: 10px 12px 10px 38px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font: inherit; font-size: 14px; }
.toolbar select { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font: inherit; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(106,134,201,.18); }
.toolbar .range { display: flex; align-items: center; gap: 6px; }
.toolbar .range input { width: 112px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font: inherit; font-size: 14px; }
.toolbar .range-sep { font-size: 13px; color: var(--muted); }
.nowrap { white-space: nowrap; }

.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; padding: 13px 16px; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }
table.data td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .12s var(--ease); }
table.data tbody tr:hover { background: var(--surface-2); }
.cell-img { width: 56px; }
.cell-img img, .cell-img .noimg { width: 48px; height: 40px; border-radius: 8px; object-fit: cover; display: block; background: var(--surface-2); border: 1px solid var(--line); }
.cell-img .noimg { display: grid; place-items: center; color: #c2ccd9; }
.cell-img .noimg .icon { width: 18px; height: 18px; }
.t-title { font-weight: 600; color: var(--ink); }
.t-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.badge .icon { width: 13px; height: 13px; }
.badge-on { background: #e7f4ec; color: #0a6b3d; }
.badge-off { background: #f1f4f8; color: #7a8698; }
.badge-modulo { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.badge-nivel-info { background: var(--info-soft); color: var(--info); }
.badge-nivel-aviso { background: var(--warn-soft); color: var(--warn); }
.badge-nivel-erro { background: var(--danger-soft); color: var(--danger); }
.count-pill { font-size: 13px; color: var(--muted); font-weight: 500; }

.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; font-size: 13px; color: var(--muted); }
.pagination .pages { display: flex; gap: 6px; }
.pagination a, .pagination span.cur { display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink-2); text-decoration: none; font-weight: 600; }
.pagination a .icon { width: 16px; height: 16px; }
.pagination a:hover { background: var(--surface-2); }
.pagination span.cur { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination .disabled { opacity: .4; pointer-events: none; }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .icon { width: 32px; height: 32px; margin-bottom: 10px; color: #c2ccd9; }

.link-back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); text-decoration: none; margin-bottom: 14px; font-weight: 600; }
.link-back:hover { color: var(--ink); }
.link-back .icon { width: 16px; height: 16px; }

/* =========================================================
   Ficha de edição
   ========================================================= */
.edit-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; align-items: start; }
.form-row { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.form-row:last-child { margin-bottom: 0; }
.form-row > label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.form-row input[type=text], .form-row input[type=url], .form-row input[type=password], .form-row textarea, .form-row select {
    width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface-2); font: inherit; font-size: 14.5px; color: var(--ink);
    transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
}
.form-row textarea { min-height: 150px; resize: vertical; line-height: 1.6; }
.form-row input:focus, .form-row textarea:focus, .form-row select:focus { outline: none; background: var(--surface); border-color: var(--brand); box-shadow: 0 0 0 4px rgba(106,134,201,.16); }
.help { font-size: 12px; color: var(--muted); }

.switch { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 44px; height: 26px; border-radius: 999px; background: #cdd5e0; position: relative; transition: background .18s var(--ease); flex-shrink: 0; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-xs); transition: transform .18s var(--ease); }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch .switch-txt strong { display: block; font-size: 14px; }
.switch .switch-txt span { font-size: 12px; color: var(--muted); }

.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }

.meta-list { display: flex; flex-direction: column; }
.meta-item { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.meta-item:last-child { border-bottom: 0; }
.meta-item .k { color: var(--muted); }
.meta-item .v { font-weight: 600; text-align: right; }

.note { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; color: var(--muted); background: var(--surface-2); border: 1px dashed var(--line); border-radius: 10px; padding: 11px 13px; margin-top: 14px; }
.note .icon { width: 16px; height: 16px; margin-top: 1px; flex-shrink: 0; color: var(--brand); }

/* Fotos */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.photo { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); position: relative; }
.photo img { width: 100%; height: 110px; object-fit: cover; display: block; background: var(--surface-2); }
.photo .noimg { display: grid; place-items: center; color: #c2ccd9; }
.photo .photo-bar { display: flex; align-items: center; justify-content: space-between; padding: 7px 8px; gap: 4px; }
.photo .principal-tag { position: absolute; top: 8px; left: 8px; background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; display: inline-flex; align-items: center; gap: 4px; box-shadow: var(--shadow-sm); }
.photo .principal-tag .icon { width: 12px; height: 12px; }
.icon-mini { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); cursor: pointer; }
.icon-mini:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.icon-mini:disabled { opacity: .4; cursor: default; }
.icon-mini .icon { width: 15px; height: 15px; }
.btn-mini { font-size: 11.5px; font-weight: 600; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--brand-700); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.btn-mini:hover { background: var(--brand-soft); }
.btn-mini .icon { width: 13px; height: 13px; }
.inline-form { display: inline; }

/* Foto clicável + hint de ampliar */
.photo-zoom { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; position: relative; }
.photo-zoom img { width: 100%; height: 110px; object-fit: cover; display: block; background: var(--surface-2); }
.photo-zoom .zoom-hint { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: rgba(15,23,42,.55); color: #fff; opacity: 0; transition: opacity .16s var(--ease); }
.photo-zoom .zoom-hint .icon { width: 15px; height: 15px; }
.photo:hover .photo-zoom .zoom-hint { opacity: 1; }

/* Lightbox / galeria */
.lightbox { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; background: rgba(9,13,22,.93); }
.lightbox.open { display: flex; }
.lb-figure { margin: 0; max-width: 92vw; max-height: 88vh; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.lb-img { max-width: 92vw; max-height: 80vh; object-fit: contain; border-radius: 6px; box-shadow: 0 12px 48px rgba(0,0,0,.55); background: #fff; }
.lb-info { display: flex; align-items: center; gap: 12px; color: #e5eaf2; font-size: 13.5px; }
.lb-count { color: #9aa7ba; font-variant-numeric: tabular-nums; }
.lb-close, .lb-nav { position: absolute; display: grid; place-items: center; border: 0; cursor: pointer; color: #fff; background: rgba(255,255,255,.12); border-radius: 999px; transition: background .16s var(--ease); }
.lb-close:hover, .lb-nav:hover { background: rgba(255,255,255,.24); }
.lb-close { top: 18px; right: 20px; width: 44px; height: 44px; }
.lb-close .icon { width: 22px; height: 22px; }
.lb-nav { top: 50%; transform: translateY(-50%); width: 52px; height: 52px; }
.lb-nav .icon { width: 28px; height: 28px; }
.lb-prev { left: 18px; }
.lb-next { right: 18px; }
@media (max-width: 640px) { .lb-nav { width: 42px; height: 42px; } .lb-prev { left: 8px; } .lb-next { right: 8px; } }

/* Miniatura da listagem que abre a galeria */
.thumb-galeria { position: relative; display: block; padding: 0; border: 0; background: none; cursor: zoom-in; }
.thumb-galeria img { width: 48px; height: 40px; border-radius: 8px; object-fit: cover; display: block; background: var(--surface-2); border: 1px solid var(--line); transition: border-color .16s var(--ease); }
.thumb-galeria:hover img { border-color: var(--brand); }
.thumb-count { position: absolute; bottom: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.25); }

/* Tour de ajuda */
.tour-block { position: fixed; inset: 0; z-index: 300; background: transparent; }
.tour-highlight { position: absolute; z-index: 301; border-radius: 10px; border: 2px solid var(--brand); box-shadow: 0 0 0 9999px rgba(9,13,22,.6); pointer-events: none; transition: top .2s var(--ease), left .2s var(--ease), width .2s var(--ease), height .2s var(--ease); }
.tour-pop { position: absolute; z-index: 302; width: 320px; max-width: 90vw; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 16px 18px; opacity: 0; transition: opacity .15s var(--ease); }
.tour-pop.show { opacity: 1; }
.tour-title { font-weight: 700; font-size: 15px; margin-bottom: 6px; color: var(--ink); }
.tour-text { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }
.tour-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; gap: 10px; }
.tour-count { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tour-btns { display: flex; gap: 6px; }
.tour-btns button { font-size: 13px; font-weight: 600; border-radius: 8px; padding: 7px 12px; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); }
.tour-btns .tour-next { background: var(--brand); color: #fff; border-color: var(--brand); }
.tour-btns .tour-skip { border: 0; background: none; color: var(--muted); padding-left: 4px; padding-right: 4px; }

@media (max-width: 980px) { .edit-grid { grid-template-columns: 1fr; } }

/* =========================================================
   Caixa (financeiro)
   ========================================================= */
.caixa-top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.caixa-top select { padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer; min-width: 260px; }
.caixa-top select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(106,134,201,.18); }
.date-nav { display: flex; align-items: center; gap: 8px; }
.date-field { display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 40px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.date-field .icon { width: 17px; height: 17px; color: var(--muted); }
.date-field input { border: 0; background: transparent; font: inherit; font-size: 14px; color: var(--ink); }
.date-field input:focus { outline: none; }

.caixa-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.sum { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; box-shadow: var(--shadow-xs); }
.sum-k { display: block; font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 4px; }
.sum-v { font-size: 20px; font-weight: 800; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.sum-total { background: linear-gradient(140deg, var(--brand) 0%, var(--brand-600) 100%); border-color: transparent; }
.sum-total .sum-k { color: rgba(255,255,255,.8); }
.sum-total .sum-v { color: #fff; }

.lanc-bar { display: flex; gap: 12px; align-items: flex-end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); }
.lanc-bar label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.lanc-bar input { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); font: inherit; font-size: 15px; color: var(--ink); transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease); }
.lanc-bar input:focus { outline: none; background: var(--surface); border-color: var(--brand); box-shadow: 0 0 0 4px rgba(106,134,201,.16); }
.lanc-desc { flex: 1; min-width: 200px; }
.lanc-val { width: 140px; }
.lanc-val input { text-align: right; font-variant-numeric: tabular-nums; }
.lanc-bar .btn { height: 44px; }
.kbd-hint { font-size: 12.5px; color: var(--muted); margin: 10px 2px 20px; }
kbd { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; background: var(--surface); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; color: var(--ink-2); }

.caixa-table td.money, .caixa-table th.money { text-align: right; font-variant-numeric: tabular-nums; }
.caixa-table .val-in { color: #0a6b3d; font-weight: 600; }
.caixa-table .val-out { color: #b42318; font-weight: 600; }
.caixa-table .row-saldo-ant td { color: var(--muted); background: var(--surface-2); font-size: 13px; }
.caixa-table tfoot .row-total td { background: var(--surface-2); font-weight: 700; border-top: 2px solid var(--line); }

.badge-open { background: var(--brand-soft); color: var(--brand-700); }
.badge-none { background: var(--warn-soft); color: var(--warn); }
.caixa-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 18px; }
.caixa-top-right { display: flex; align-items: center; gap: 10px; }

/* Permissões (perfil) */
.perm-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.perm-group { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; background: var(--surface-2); }
.perm-group h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.perm-item { display: flex; align-items: flex-start; gap: 10px; padding: 7px 0; cursor: pointer; }
.perm-item input { margin: 2px 0 0; width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; flex-shrink: 0; }
.perm-item .perm-txt strong { display: block; font-size: 13.5px; font-weight: 600; }
.perm-item .perm-txt small { color: var(--muted); font-size: 11.5px; font-family: ui-monospace, Menlo, Consolas, monospace; }

/* =========================================================
   Modal
   ========================================================= */
.modal-overlay {
    position: fixed; inset: 0; z-index: 100;
    display: none; align-items: center; justify-content: center;
    padding: 24px;
    background: rgba(15,23,42,.5);
    backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; animation: modalFade .16s var(--ease); }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%; max-width: 780px; max-height: 85vh;
    display: flex; flex-direction: column; overflow: hidden;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.modal-head h3 .icon { width: 19px; height: 19px; color: var(--brand); }
.modal-head .icon-btn { width: 34px; height: 34px; }
.modal-head .icon-btn .icon { width: 16px; height: 16px; }
.modal-body { overflow: auto; flex: 1 1 auto; }
.modal-foot { flex-shrink: 0; display: flex; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface); }
.modal-body table.data { border: 0; }
.modal-body table.data th { position: sticky; top: 0; z-index: 1; }
.modal-filter { display: flex; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.modal-filter select { padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; }
.modal-filter select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(106,134,201,.18); }

@media (max-width: 820px) {
    .caixa-summary { grid-template-columns: repeat(2, 1fr); }
    .lanc-bar { flex-wrap: wrap; }
    .lanc-desc { flex-basis: 100%; }
}

@media (max-width: 900px) {
    .auth-brandside { display: none; }
    .auth-wrap { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .sidebar { display: none; }
    .content { padding: 20px; }
    .topbar { padding: 0 18px; }
}
