/* ============================================================
   Intranet Casa Seciu — design system (CSS custom, fără framework)
   Paletă: bordo/vin + auriu cald + neutre crem.
   ============================================================ */

:root {
    --wine: #7b2d3b;
    --wine-dark: #5e1f2b;
    --wine-700: #6d2734;
    --gold: #b8893b;
    --gold-soft: #e7cd9a;
    --cream: #faf6f0;
    --surface: #ffffff;
    --ink: #2a2421;
    --muted: #847b72;
    --line: #e9e1d6;
    --line-strong: #d8ccbb;
    --ok: #2f7d4f;
    --ok-bg: #e9f5ee;
    --warn: #9a6a12;
    --warn-bg: #fbf1dc;
    --err: #b5283a;
    --err-bg: #fbe9eb;
    --info: #2b5f86;
    --info-bg: #e6f0f7;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(42, 36, 33, .06), 0 6px 20px rgba(42, 36, 33, .06);
    --shadow-sm: 0 1px 2px rgba(42, 36, 33, .08);
    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font);
    color: var(--ink);
    background: var(--cream);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--wine); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0 0 .4em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
p { margin: 0 0 1em; }

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

.sidebar {
    width: 248px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--wine) 0%, var(--wine-dark) 100%);
    color: #f3e7da;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar__brand {
    display: flex; align-items: center; gap: .65rem;
    padding: 1.15rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.sidebar__logo {
    width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-soft) 100%);
    color: var(--wine-dark); font-weight: 800; font-size: 1rem;
    display: grid; place-items: center;
}
.sidebar__brand b { color: #fff; font-size: .98rem; line-height: 1.1; display: block; }
.sidebar__brand span { color: #d8b9b0; font-size: .72rem; }

.nav { padding: .75rem .6rem; overflow-y: auto; flex: 1; }
.nav__label {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
    color: #c79a92; padding: .9rem .65rem .35rem; font-weight: 600;
}
.nav a {
    display: flex; align-items: center; gap: .65rem;
    padding: .55rem .65rem; margin: .1rem 0;
    border-radius: var(--radius-sm);
    color: #ecdcd0; font-size: .9rem; font-weight: 500;
    text-decoration: none; transition: background .12s, color .12s;
}
.nav a:hover { background: rgba(255, 255, 255, .08); text-decoration: none; }
.nav a.is-active { background: rgba(255, 255, 255, .15); color: #fff; }
.nav a .ic { width: 18px; text-align: center; font-size: 1rem; }

.sidebar__foot {
    padding: .85rem 1rem; border-top: 1px solid rgba(255, 255, 255, .12);
    font-size: .8rem;
}
.sidebar__foot .who { color: #fff; font-weight: 600; }
.sidebar__foot .role { color: #d8b9b0; font-size: .72rem; }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; padding: .7rem 1.5rem;
    background: var(--surface); border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 20;
}
.topbar .crumbs { font-size: .85rem; color: var(--muted); display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.topbar .crumbs a { color: var(--muted); }
.topbar .crumbs a:hover { color: var(--wine); }
.topbar .crumbs .sep { color: var(--line-strong); }
.topbar .crumbs .cur { color: var(--ink); font-weight: 600; }

.content { padding: 1.5rem; max-width: 1180px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); font-size: .9rem; margin-top: .15rem; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card__head { padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.card__head h2 { margin: 0; font-size: 1rem; }
.card__body { padding: 1.25rem; }
.grid { display: grid; gap: 1.1rem; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: .45rem;
    padding: .5rem .9rem; border-radius: var(--radius-sm);
    font-size: .88rem; font-weight: 600; font-family: inherit;
    border: 1px solid transparent; cursor: pointer; text-decoration: none;
    transition: background .12s, border-color .12s, opacity .12s; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--wine); color: #fff; }
.btn--primary:hover { background: var(--wine-dark); color: #fff; }
.btn--gold { background: var(--gold); color: #fff; }
.btn--gold:hover { background: #a3792f; color: #fff; }
.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--cream); }
.btn--danger { background: var(--err-bg); color: var(--err); border-color: #f2c9ce; }
.btn--danger:hover { background: #f7d8dc; }
.btn--sm { padding: .32rem .6rem; font-size: .8rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th {
    text-align: left; padding: .6rem .8rem; font-size: .72rem; text-transform: uppercase;
    letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--line); font-weight: 600;
}
.table td { padding: .65rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--cream); }
.table .right { text-align: right; }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .14rem .5rem; border-radius: 999px; font-size: .73rem; font-weight: 600;
    background: var(--cream); color: var(--muted); border: 1px solid var(--line);
}
.badge--editor { background: #eef6f0; color: var(--ok); border-color: #cfe7d8; }
.badge--viewer { background: var(--info-bg); color: var(--info); border-color: #cfe0ee; }
.badge--admin { background: #f4e9ec; color: var(--wine); border-color: #e6cdd3; }
.badge--off { background: #f1eeea; color: var(--muted); }
.badge--on { background: var(--ok-bg); color: var(--ok); border-color: #cfe7d8; }

/* ---------- Forms ---------- */
.field { margin-bottom: 1.05rem; }
.field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .35rem; }
.field .hint { font-size: .78rem; color: var(--muted); margin-top: .3rem; }
.input, .select, .textarea {
    width: 100%; padding: .55rem .7rem; font-size: .92rem; font-family: inherit;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    background: #fff; color: var(--ink);
}
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--wine); box-shadow: 0 0 0 3px rgba(123, 45, 59, .12);
}
.textarea { min-height: 140px; resize: vertical; }
.field--error .input, .field--error .select, .field--error .textarea { border-color: var(--err); }
.field__err { color: var(--err); font-size: .78rem; margin-top: .3rem; }

.check-list { display: flex; flex-direction: column; gap: .4rem; max-height: 260px; overflow-y: auto; padding: .25rem; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.check {
    display: flex; align-items: center; gap: .55rem; padding: .4rem .55rem; border-radius: 6px; cursor: pointer; font-size: .9rem;
}
.check:hover { background: var(--cream); }
.check input { width: 16px; height: 16px; accent-color: var(--wine); }

/* ---------- Flash ---------- */
.flash { padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: .9rem; font-weight: 500; border: 1px solid; display: flex; gap: .5rem; align-items: center; }
.flash--success { background: var(--ok-bg); color: var(--ok); border-color: #cfe7d8; }
.flash--error { background: var(--err-bg); color: var(--err); border-color: #f2c9ce; }
.flash--info { background: var(--info-bg); color: var(--info); border-color: #cfe0ee; }

/* ---------- File browser ---------- */
.fb-row { display: flex; align-items: center; gap: .75rem; }
.fb-icon { font-size: 1.35rem; width: 28px; text-align: center; flex-shrink: 0; }
.fb-name { font-weight: 600; color: var(--ink); }
.fb-name a { color: var(--ink); }
.fb-name a:hover { color: var(--wine); }
.fb-meta { color: var(--muted); font-size: .8rem; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty .big { font-size: 2.5rem; }

/* ---------- Quick links (dashboard) ---------- */
.qlink {
    display: flex; align-items: center; gap: .75rem; padding: .9rem 1rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    color: var(--ink); box-shadow: var(--shadow-sm); transition: transform .1s, box-shadow .12s;
}
.qlink:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--gold-soft); }
.qlink .em { font-size: 1.5rem; }
.qlink b { display: block; }
.qlink span { color: var(--muted); font-size: .8rem; word-break: break-all; }

/* ---------- Upload ---------- */
.dropzone {
    border: 2px dashed var(--line-strong); border-radius: var(--radius);
    padding: 1.5rem; text-align: center; color: var(--muted); background: var(--cream);
    transition: border-color .12s, background .12s; cursor: pointer;
}
.dropzone.drag { border-color: var(--wine); background: #f6ecec; color: var(--wine); }
.upload-item { display: flex; align-items: center; gap: .75rem; padding: .55rem 0; border-top: 1px solid var(--line); font-size: .85rem; }
.upload-item:first-child { border-top: none; }
.progress { flex: 1; height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--wine), var(--gold)); transition: width .2s; }

/* ---------- Announcements ---------- */
.ann { padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--line); }
.ann:last-child { border-bottom: none; }
.ann h3 { margin: 0 0 .2rem; font-size: 1.02rem; }
.ann .ann-meta { color: var(--muted); font-size: .78rem; margin-bottom: .5rem; }
.ann .ann-body { white-space: pre-wrap; color: #3c352f; font-size: .92rem; }

/* ---------- Misc ---------- */
.muted { color: var(--muted); }
.divider { height: 1px; background: var(--line); margin: 1.25rem 0; border: none; }
.tag-row { display: flex; flex-wrap: wrap; gap: .35rem; }
.pill { font-size: .72rem; padding: .12rem .5rem; border-radius: 999px; background: var(--cream); border: 1px solid var(--line); color: var(--muted); }
.radio-cards { display: flex; gap: .6rem; flex-wrap: wrap; }
.radio-card { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: .55rem .8rem; cursor: pointer; font-size: .88rem; display: flex; gap: .45rem; align-items: center; }
.radio-card input { accent-color: var(--wine); }
.prose h2 { margin-top: 1.6rem; }
.prose h3 { margin-top: 1.2rem; color: var(--wine); }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: .35rem; }
.prose code { background: var(--cream); padding: .1rem .35rem; border-radius: 5px; font-size: .85em; border: 1px solid var(--line); }
.kbd-step { background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: .8rem; }
.kbd-step b { color: var(--wine); }

.menu { position: relative; }
.menu__btn { background: none; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: .35rem .7rem; cursor: pointer; font-size: 1rem; line-height: 1; }
.menu__pop { display: none; position: absolute; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); min-width: 190px; z-index: 30; overflow: hidden; }
.menu__pop.open { display: block; }
.menu__pop a, .menu__pop button { display: flex; width: 100%; align-items: center; gap: .5rem; padding: .6rem .85rem; font-size: .88rem; background: none; border: none; text-align: left; cursor: pointer; color: var(--ink); }
.menu__pop a:hover, .menu__pop button:hover { background: var(--cream); text-decoration: none; }
.menu__pop .danger { color: var(--err); }

/* ---------- Auth page ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
    background: radial-gradient(1200px 600px at 50% -10%, #8a3543 0%, var(--wine-dark) 55%, #3f141d 100%); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.3); overflow: hidden; }
.auth-card__head { padding: 1.75rem 1.75rem 1rem; text-align: center; }
.auth-card__head .logo { width: 54px; height: 54px; border-radius: 14px; margin: 0 auto .8rem;
    background: linear-gradient(135deg, var(--gold), var(--gold-soft)); color: var(--wine-dark);
    font-weight: 800; font-size: 1.25rem; display: grid; place-items: center; }
.auth-card__body { padding: 0 1.75rem 1.75rem; }

/* ---------- Tabele cu scroll orizontal (mobil) ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- Responsive ---------- */
.menu-toggle { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--wine); padding: .25rem .4rem; }

@media (max-width: 860px) {
    .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow);
        padding-top: env(safe-area-inset-top); }
    .sidebar.open { transform: translateX(0); }
    .menu-toggle { display: block; }
    .content { padding: 1rem; padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
    .topbar { padding: .6rem 1rem; padding-top: calc(.6rem + env(safe-area-inset-top)); }
    .scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; }
    .scrim.show { display: block; }
}

@media (max-width: 680px) {
    body { font-size: 15px; }
    h1 { font-size: 1.3rem; }
    .page-head { gap: .65rem; }
    .page-head .actions, .page-head .actions form { width: 100%; }
    .page-head .actions .btn { flex: 1; justify-content: center; }
    /* butoane & câmpuri cu touch target generos */
    .btn { padding: .6rem 1rem; min-height: 44px; }
    .btn--sm { min-height: 38px; padding: .45rem .7rem; }
    .input, .select, .textarea { font-size: 16px; padding: .65rem .75rem; } /* 16px = fără zoom iOS */
    .nav a { padding: .7rem .65rem; }
    .card__body { padding: 1rem; }
    .grid--2 { grid-template-columns: 1fr; }

    /* tabelele admin (multe coloane) scrollează orizontal */
    .table-wrap > .table { min-width: 560px; }

    /* coloane secundare ascunse pe ecrane mici (ex. browserul de fișiere) */
    .col-hide-sm { display: none; }

    /* meniul ⋯ devine bottom-sheet (nu se mai taie în containere cu scroll) */
    .menu__pop.open {
        position: fixed; left: 0; right: 0; bottom: 0; top: auto;
        width: 100%; min-width: 0; max-width: 100%;
        border: none; border-radius: 18px 18px 0 0;
        box-shadow: 0 -10px 40px rgba(0,0,0,.3);
        padding: .4rem 0 calc(.4rem + env(safe-area-inset-bottom));
        z-index: 60; animation: sheetUp .18s ease;
    }
    .menu__pop.open a, .menu__pop.open button { padding: .95rem 1.4rem; font-size: 1.02rem; }
    body.sheet-open::after { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 55; }
}

@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
