:root {
    --ink: #0a0c0d;
    --panel: #111417;
    --yellow: #f7b900;
    --yellow-dark: #d89f00;
    --paper: #f4f5f6;
    --line: #dfe3e6;
    --muted: #667078;
    --danger: #b42318;
}

html { background: var(--paper); }
body { margin: 0; color: #1b2227; background: var(--paper); }

.btn-primary {
    --bs-btn-color: #090b0c;
    --bs-btn-bg: var(--yellow);
    --bs-btn-border-color: var(--yellow);
    --bs-btn-hover-color: #090b0c;
    --bs-btn-hover-bg: #ffc933;
    --bs-btn-hover-border-color: #ffc933;
    --bs-btn-active-color: #090b0c;
    --bs-btn-active-bg: var(--yellow-dark);
    --bs-btn-active-border-color: var(--yellow-dark);
    --bs-btn-disabled-color: #090b0c;
    --bs-btn-disabled-bg: #e9c85f;
    --bs-btn-disabled-border-color: #e9c85f;
    font-weight: 750;
}
.btn-outline-primary {
    --bs-btn-color: #8b6800;
    --bs-btn-border-color: #c39000;
    --bs-btn-hover-color: #090b0c;
    --bs-btn-hover-bg: var(--yellow);
    --bs-btn-hover-border-color: var(--yellow);
    --bs-btn-active-color: #090b0c;
    --bs-btn-active-bg: var(--yellow-dark);
    --bs-btn-active-border-color: var(--yellow-dark);
    font-weight: 700;
}

.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: 260px; flex: 0 0 260px; color: #fff; background: var(--ink); }
.sidebar-inner { position: sticky; top: 0; display: flex; flex-direction: column; min-height: 100vh; padding: 26px 18px 20px; }
.brand { color: #fff; text-decoration: none; font-size: 20px; font-weight: 900; letter-spacing: .08em; }
.brand::before { content: ""; display: inline-block; width: 11px; height: 28px; margin-right: 10px; vertical-align: middle; border-radius: 3px; background: var(--yellow); box-shadow: 7px 0 0 #8d6b00; }
.brand small { display: block; margin: 5px 0 0 31px; color: #a8afb4; font-size: 10px; letter-spacing: .18em; }
.brand-dark { color: var(--ink); }
.sidebar .nav-link { display: flex; gap: 11px; align-items: center; padding: 11px 13px; color: #cfd4d7; border-radius: 9px; font-weight: 650; }
.sidebar .nav-link span { width: 18px; color: var(--yellow); text-align: center; }
.sidebar .nav-link:hover, .sidebar .nav-link.active { color: #fff; background: #22272b; }
/* Subrubricile Contracte / Oferte, sub Documente. */
.sidebar .nav-link.nav-sub { padding-left: 30px; font-weight: 600; font-size: .94em; color: #aeb5ba; }

.content { width: calc(100% - 260px); min-width: 0; }
.app-header { position: sticky; top: 0; z-index: 30; display: flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 92px; padding: 18px 42px; background: rgba(244,245,246,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.header-actions { display: flex; gap: 9px; }
.app-view { padding: 34px 42px 60px; }

.card { border-color: var(--line); border-radius: 15px; box-shadow: 0 8px 28px rgba(11,16,19,.05); }
.stat-card { min-height: 132px; }
.stat-card .number { margin-top: 8px; color: var(--ink); font-size: 34px; font-weight: 900; line-height: 1; }
.stat-card .accent { color: #9a7200; }
.section-title { font-size: 18px; font-weight: 800; }
.contract-shell { max-width: 1120px; margin: 0 auto; }
.step { margin-bottom: 3px; color: #8b6800; font-size: 12px; font-weight: 850; letter-spacing: .11em; }
.form-label { margin-bottom: 5px; font-size: 13px; font-weight: 700; }
.form-control, .form-select { min-height: 44px; border-color: #cfd5d9; }
textarea.form-control { min-height: 76px; }
.form-control:focus, .form-select:focus { border-color: #c99700; box-shadow: 0 0 0 .2rem rgba(247,185,0,.18); }
.inventory-table input, .stock-table input { min-width: 92px; }
.summary-box { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; padding: 18px; border: 1px solid #e1c66d; border-radius: 13px; background: #fffaf0; }
.summary-item span { display: block; color: var(--muted); font-size: 12px; }
.summary-item strong { display: block; margin-top: 3px; font-size: 17px; }
.summary-item.total strong { color: #775800; font-size: 21px; }
.minimum-note { color: #725600; font-size: 13px; }
.document-type-badge { display: inline-flex; min-width: 70px; justify-content: center; }
.table > :not(caption) > * > * { padding: .8rem .7rem; }
.table thead th { color: #5f6970; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.empty-state { padding: 50px 20px; color: var(--muted); text-align: center; }
.loading { padding: 45px 20px; color: var(--muted); text-align: center; }
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; background: radial-gradient(circle at top,#fff 0,var(--paper) 50%); }
.login-page form { width: min(420px,100%); }
.login-page .brand { display: inline-block; margin-bottom: 22px; }
.notice-no-vat { display: inline-flex; align-items: center; gap: 6px; color: #496056; font-size: 13px; }
.notice-no-vat::before { content: "✓"; color: #287a51; font-weight: 900; }
.identity-reader { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 14px 18px; align-items: center; padding: 16px; border: 1px solid #e1c66d; border-radius: 13px; background: #fffaf0; }
.identity-reader strong { display: block; margin-bottom: 3px; color: #4f3c00; }
.identity-reader p { color: #667078; font-size: 12px; line-height: 1.45; }
.identity-reader-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.identity-reader-progress, .identity-reader #identity-result { grid-column: 1 / -1; }
.identity-reader-progress { display: grid; grid-template-columns: minmax(120px,1fr) auto; gap: 10px; align-items: center; }
.identity-reader-progress .progress { height: 8px; background: #eee5c8; }
.identity-reader-progress .progress-bar { background: var(--yellow-dark); transition: width .2s ease; }
.identity-reader-progress span { color: var(--muted); font-size: 12px; }

@media (max-width: 991.98px) {
    .sidebar { width: min(82vw,290px); }
    .sidebar-inner { position: static; min-height: calc(100vh - 72px); padding-top: 8px; }
    .sidebar .offcanvas-header { min-height: 72px; background: var(--ink); }
    .content { width: 100%; }
    .app-header { min-height: 78px; padding: 13px 16px; }
    .app-header h1 { font-size: 21px; }
    .app-header .text-secondary { display: none; }
    .app-view { padding: 22px 14px 50px; }
    .header-actions .btn { padding: 9px 11px; font-size: 13px; }
    .summary-box { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 575.98px) {
    .app-header { align-items: flex-start; }
    .header-actions { gap: 6px; }
    .header-actions .btn { font-size: 0; }
    .header-actions .btn::first-letter { font-size: 16px; }
    .header-actions #new-contract::after { content: " Contract"; font-size: 13px; }
    .header-actions #new-offer::after { content: " Ofertă"; font-size: 13px; }
    .card.p-4 { padding: 18px !important; }
    .summary-box { grid-template-columns: 1fr; }
    .table-responsive { font-size: 14px; }
    .editor-actions { display: grid !important; }
    .editor-actions .btn { width: 100%; }
    .identity-reader { grid-template-columns: 1fr; }
    .identity-reader-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .identity-reader-actions .btn { width: 100%; }
    .identity-reader-progress { grid-template-columns: 1fr; gap: 6px; }
}
