/* ============================================================
   accounty — main app theme on top of Bootstrap 5
   Palette and typography from /theme (auth.css + brand kit)
   ============================================================ */

:root {
    --acc: #22614f;
    --acc-strong: #17493b;
    --tint: #e5eeea;
    --side: #0f211b;
    --text: #1f2622;
    --muted: #5d665f;
    --faint: #8a938c;
    --border: #dfe3dd;
    --border-soft: #e3e6e1;
    --error: #a34b2e;
    --ok: #2e8f63;
    --warn: #c08a2e;
    --mono: 'IBM Plex Mono', ui-monospace, monospace;

    --bs-primary: var(--acc);
    --bs-primary-rgb: 34, 97, 79;
    --bs-body-bg: #f7f8f5;
    --bs-body-color: var(--text);
    --bs-border-color: var(--border-soft);
    --bs-link-color: var(--acc);
    --bs-link-hover-color: var(--acc-strong);
    --bs-body-font-family: 'IBM Plex Sans', system-ui, sans-serif;
    --bs-body-font-size: 0.9rem; /* desktop base (~14px) */
}

/* Mobile: bump base to 16px and force all inputs to 16px so iOS Safari
   doesn't auto-zoom on focus. Desktop keeps the original 14px scale. */
@media (max-width: 767.98px) {
    :root { --bs-body-font-size: 1rem; }
    .form-control, .form-select,
    .form-control-sm, .form-select-sm { font-size: 16px; }
}

body {
    min-height: 100vh;
    background: var(--bs-body-bg);
    -webkit-font-smoothing: antialiased;
}

body.bg-light { background-color: var(--bs-body-bg) !important; }

/* ---------- app shell: left sidebar ---------- */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 232px;
    flex: none;
    background: var(--side);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 18px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.side-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #fff;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: -0.2px;
    text-decoration: none;
    padding: 4px 8px;
}
.side-brand:hover { color: #fff; }
.side-brand img { width: 26px; height: 26px; border-radius: 7px; }

.side-section {
    font: 600 9.5px var(--mono);
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.38);
    margin: 22px 8px 6px;
}

.side-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 7px;
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 2px;
}
.side-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.side-link.is-active { background: var(--acc); color: #fff; }
.side-link .bi { font-size: 15px; width: 18px; text-align: center; }

.side-footer { margin-top: auto; padding-top: 16px; }

.side-lang { display: flex; gap: 2px; margin: 0 4px; }
.side-lang a {
    flex: 1;
    text-align: center;
    padding: 4px 0;
    border-radius: 5px;
    color: rgba(255, 255, 255, 0.5);
    font: 600 10px var(--mono);
    letter-spacing: 1px;
    text-decoration: none;
}
.side-lang a:hover { color: #fff; }
.side-lang a.is-active { background: rgba(255, 255, 255, 0.1); color: #fff; }

.side-user {
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 11.5px;
    line-height: 1.45;
}
.side-user strong { display: block; color: #fff; font-size: 12.5px; }
.side-profile-link { text-decoration: none; }
.side-profile-link:hover strong { color: var(--tint); }
.side-profile-link .bi { opacity: 0.55; font-size: 10.5px; }
.side-user span { color: rgba(255, 255, 255, 0.5); word-break: break-word; }

.side-signout {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 0;
}
.side-signout:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.app-topbar {
    display: none;
    align-items: center;
    gap: 12px;
    background: var(--side);
    color: #fff;
    font-weight: 600;
    padding: 10px 16px;
}
.topbar-toggle { background: none; border: none; color: #fff; font-size: 22px; line-height: 1; padding: 0; }

.brand-mark { width: 26px; height: 26px; border-radius: 7px; }

.app-content {
    padding: 24px clamp(16px, 3vw, 36px) 48px;
    width: 100%;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 33, 27, 0.55);
    z-index: 1040;
}
.sidebar-backdrop.show { display: block; }

@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 1045;
        width: 250px;
        transform: translateX(-105%);
        transition: transform 0.2s ease;
    }
    .sidebar.open { transform: none; }
    .app-topbar { display: flex; }
}

/* ---------- document preview panel ---------- */

.doc-preview-frame {
    width: 100%;
    height: 460px;
    border: 0;
    border-radius: 0 0 0 0;
    background: #eceee8;
}

.doc-preview-img {
    width: 100%;
    max-height: 460px;
    object-fit: contain;
    background: #eceee8;
}

.doc-preview-empty {
    height: 200px;
    display: grid;
    place-items: center;
    background: #fbfcf9;
    color: var(--faint);
    text-align: center;
    font-size: 0.85rem;
}
.doc-preview-empty .bi { font-size: 2rem; display: block; }

.doc-meta dt {
    font: 600 0.65rem var(--mono);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--faint);
    margin-bottom: 1px;
}
.doc-meta dd { font-size: 0.85rem; margin-bottom: 0.6rem; word-break: break-word; }

tr.doc-row { cursor: pointer; }
tr.doc-row.table-active { --bs-table-active-bg: var(--tint); }

/* ---------- buttons ---------- */

.btn { border-radius: 7px; font-weight: 600; }

.btn-primary {
    --bs-btn-bg: var(--acc);
    --bs-btn-border-color: var(--acc);
    --bs-btn-hover-bg: var(--acc-strong);
    --bs-btn-hover-border-color: var(--acc-strong);
    --bs-btn-active-bg: var(--acc-strong);
    --bs-btn-active-border-color: var(--acc-strong);
    --bs-btn-disabled-bg: var(--acc);
    --bs-btn-disabled-border-color: var(--acc);
}

.btn-outline-primary {
    --bs-btn-color: var(--acc);
    --bs-btn-border-color: var(--acc);
    --bs-btn-hover-bg: var(--acc);
    --bs-btn-hover-border-color: var(--acc);
    --bs-btn-active-bg: var(--acc-strong);
    --bs-btn-active-border-color: var(--acc-strong);
}

.btn-outline-secondary {
    --bs-btn-color: #3c453e;
    --bs-btn-border-color: var(--border);
    --bs-btn-hover-bg: #fbfcf9;
    --bs-btn-hover-border-color: #b9c2ba;
    --bs-btn-hover-color: #3c453e;
    --bs-btn-active-bg: var(--tint);
    --bs-btn-active-border-color: #b9c2ba;
    --bs-btn-active-color: var(--acc-strong);
    background-color: #fff;
}

.btn-success {
    --bs-btn-bg: var(--ok);
    --bs-btn-border-color: var(--ok);
    --bs-btn-hover-bg: #267a52;
    --bs-btn-hover-border-color: #267a52;
}

/* ---------- links, forms, focus ---------- */

a { color: var(--acc); }
a:hover { color: var(--acc-strong); }

.form-control, .form-select {
    border-color: var(--border);
    border-radius: 7px;
    color: var(--text);
}

.form-control:focus, .form-select:focus {
    border-color: var(--acc);
    box-shadow: 0 0 0 0.2rem rgba(34, 97, 79, 0.12);
}

.form-check-input:checked {
    background-color: var(--acc);
    border-color: var(--acc);
}

.form-label { font-size: 0.78rem; font-weight: 600; }

/* ---------- cards & tables ---------- */

.card {
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    box-shadow: none;
}

a.card:hover { border-color: #b9c2ba; box-shadow: 0 2px 8px rgba(20, 30, 25, 0.08); }

.card-header {
    border-bottom-color: var(--border-soft);
    font-size: 0.85rem;
}

.table { --bs-table-hover-bg: #fbfcf9; }

.table thead th {
    font: 600 0.68rem var(--mono);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--faint);
    background: #fbfcf9;
}

.breadcrumb { font-size: 0.85rem; margin-bottom: 0; }

/* ---------- badges (statuses) ---------- */

.badge { font-weight: 600; border-radius: 5px; }

.badge.text-bg-success { background-color: var(--ok) !important; }
.badge.text-bg-warning { background-color: #f2e3c0 !important; color: #8a6420 !important; }
.badge.text-bg-danger  { background-color: var(--error) !important; }
.badge.text-bg-info    { background-color: var(--tint) !important; color: var(--acc-strong) !important; }

/* ---------- alerts ---------- */

.alert { border-radius: 8px; font-size: 0.85rem; }
.alert-success { background: #e9f3ed; border-color: #cfe4d8; color: #1d6b47; }
.alert-danger  { background: #f6ece7; border-color: #e0b7a8; color: var(--error); }
.alert-warning { background: #f7f0e2; border-color: #e3cf9f; color: #8a6420; }
.alert-info    { background: var(--tint); border-color: #cfe0d8; color: var(--acc-strong); }

.bg-primary-subtle { background-color: var(--tint) !important; }

/* ---------- misc ---------- */

.text-primary { color: var(--acc) !important; }

#notif-badge { font-size: 0.65rem; }

.dropdown-menu { border-color: var(--border-soft); border-radius: 8px; font-size: 0.85rem; }
.dropdown-item.active { background-color: var(--acc); }

/* flatpickr accent */
.flatpickr-day.selected,
.flatpickr-day.selected:hover { background: var(--acc); border-color: var(--acc); }
.flatpickr-monthSelect-month.selected { background: var(--acc) !important; }

@media (max-width: 575.98px) {
    .btn { white-space: nowrap; }
    h1.h3 { font-size: 1.3rem; }
}

/* ---------- public pages (privacy) ---------- */

.public-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px clamp(16px, 4vw, 40px);
    background: var(--side);
}
.public-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #fff;
    font-weight: 600;
    font-size: 16px;
    text-decoration: none;
}
.public-brand img { width: 26px; height: 26px; border-radius: 7px; }
.public-lang { font: 500 11px var(--mono); letter-spacing: 1px; }
.public-lang a { color: rgba(255, 255, 255, 0.5); text-decoration: none; padding: 0 4px; }
.public-lang a.is-active { color: #fff; font-weight: 600; }

.public-content {
    max-width: 820px;
    margin: 0 auto;
    padding: 32px clamp(16px, 4vw, 40px) 64px;
}
.public-content h1 { font-size: 1.7rem; font-weight: 600; letter-spacing: -0.4px; }
.public-content h2 { font-size: 1.05rem; font-weight: 600; margin-top: 1.8rem; }
.public-content p, .public-content li { color: #33403a; line-height: 1.65; font-size: 0.92rem; }
.public-content .updated { color: var(--faint); font: 500 12px var(--mono); }

.public-footer {
    text-align: center;
    padding: 20px;
    color: var(--faint);
    font-size: 12px;
    border-top: 1px solid var(--border-soft);
}
.public-footer a { color: var(--acc); text-decoration: none; }

.side-privacy {
    display: block;
    margin: 8px 4px 0;
    color: rgba(255, 255, 255, 0.45);
    font-size: 11px;
    text-decoration: none;
}
.side-privacy:hover { color: rgba(255, 255, 255, 0.8); }

/* ---------- upload dropzone ---------- */

.dropzone {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 28px 20px;
    text-align: center;
    background: #fbfcf9;
    transition: border-color .15s ease, background .15s ease;
}
.dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.dropzone.dragover { border-color: var(--acc); background: var(--tint); }
.dropzone-prompt { pointer-events: none; }
.dropzone-prompt .bi { font-size: 1.9rem; color: var(--acc); display: block; margin-bottom: 6px; }

.dropzone-files { list-style: none; margin: 12px 0 0; padding: 0; }
.dropzone-files li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: .85rem;
}
.dropzone-files li .df-name { word-break: break-all; }
.dropzone-files li .df-size { color: var(--faint); white-space: nowrap; }
