/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Lora', 'Palatino Linotype', Palatino, Georgia, serif;
    background: #F4EFE4;
    color: #1C1409;
    height: 100vh;
    overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

/* ─── Shell ─── */
.shell { display: flex; height: 100vh; }
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ─── Sidebar ─── */
.sidebar {
    width: 220px; flex-shrink: 0;
    background: #1C1409;
    display: flex; flex-direction: column;
    border-right: 1px solid #2A1E0A;
}
.sidebar-brand { padding: 24px 20px 20px; border-bottom: 1px solid #2A1E0A; }
.sidebar-eyebrow {
    font-size: 10px; letter-spacing: 0.25em; color: #6A5A38;
    text-transform: uppercase; margin-bottom: 6px;
    font-family: 'Inter', sans-serif;
}
.sidebar-brand-title { font-size: 18px; font-weight: 800; color: #F0E0B0; line-height: 1.2; }
.sidebar-user { margin-top: 10px; font-size: 11px; color: #6A5A38; font-family: 'Inter', sans-serif; }
.sidebar-user span { color: #4A3A20; }

.sidebar-nav { flex: 1; padding: 16px 12px; }
.sidebar-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; margin-bottom: 4px;
    border-radius: 6px; color: #6A5A38;
    font-size: 13px; font-family: 'Inter', sans-serif;
    border-left: 3px solid transparent;
    transition: all 0.12s;
}
.sidebar-link:hover { color: #C0B090; }
.sidebar-link.is-active {
    background: #2A1E0A; color: #F0E0B0;
    font-weight: 700; border-left-color: #C8920A;
}
.sidebar-icon { font-size: 16px; font-family: monospace; }

.sidebar-stats { padding: 16px; border-top: 1px solid #2A1E0A; }
.sidebar-stat {
    display: flex; justify-content: space-between;
    font-size: 11px; color: #6A5A38; margin-bottom: 6px;
    font-family: 'Inter', sans-serif;
}
.sidebar-stat-val { color: #C8920A; font-weight: 700; }

/* ─── Topbar ─── */
.topbar {
    background: #FEFCF5; border-bottom: 1px solid #E0D4B0;
    padding: 16px 28px; display: flex; align-items: center; gap: 16px;
    flex-shrink: 0;
}
.topbar-eyebrow {
    font-size: 11px; color: #8A7A60;
    letter-spacing: 0.12em; text-transform: uppercase;
    font-family: 'Inter', sans-serif;
}
.topbar-title { margin: 0; font-size: clamp(16px, 2vw, 22px); font-weight: 800; line-height: 1.2; }
.topbar-spacer { flex: 1; }
.topbar-date { font-size: 12px; color: #8A7A60; font-family: 'Inter', sans-serif; }
.topbar-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: #1C1409; color: #F0E0B0;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
}

/* ─── Content ─── */
.content { flex: 1; overflow: auto; padding: 24px 28px; }

.flash {
    background: #E8F4E8; border: 1px solid #A8D8A8;
    color: #1A6A1A; padding: 10px 16px; border-radius: 6px;
    margin: 16px 28px 0; font-size: 13px;
}

/* ─── Stats grid (dashboard) ─── */
.stats-grid {
    display: grid; gap: 16px; margin-bottom: 32px;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.stat-card {
    background: #FEFCF5; border: 1px solid #E0D4B0;
    border-top: 3px solid var(--accent, #C8920A);
    border-radius: 8px; padding: 20px 20px 16px;
}
.stat-icon { font-size: 28px; color: var(--accent, #C8920A); font-family: monospace; margin-bottom: 6px; }
.stat-value { font-size: 32px; font-weight: 800; line-height: 1; font-family: 'Inter', sans-serif; }
.stat-label { font-size: 13px; font-weight: 600; color: #3A2A10; margin-top: 4px; }
.stat-sub { font-size: 11px; color: #8A7A60; margin-top: 2px; font-family: 'Inter', sans-serif; }

/* ─── Two-column dashboard ─── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

.panel { background: #FEFCF5; border: 1px solid #E0D4B0; border-radius: 8px; padding: 20px; }
.panel-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}
.panel-title {
    font-size: 12px; font-weight: 700; letter-spacing: 0.12em;
    text-transform: uppercase; color: #8A7A60;
    font-family: 'Inter', sans-serif;
}
.panel-link { font-size: 11px; color: #C8920A; font-family: 'Inter', sans-serif; }

.row {
    display: flex; gap: 14px; padding-bottom: 14px; margin-bottom: 14px;
    border-bottom: 1px solid #F0E8D0;
}
.row:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 4px; }

.date-chip {
    background: #1C1409; color: #F0E0B0; border-radius: 6px;
    padding: 6px 10px; text-align: center; min-width: 44px;
    font-size: 12px; font-weight: 700; line-height: 1.3;
    font-family: 'Inter', sans-serif;
}
.date-chip-month { font-size: 9px; font-weight: 400; display: block; }

.row-title { font-size: 13px; font-weight: 600; color: #1C1409;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 11px; color: #8A7A60; font-family: 'Inter', sans-serif; }
.row-meta { font-size: 10px; color: #C8920A; margin-top: 2px; font-family: 'Inter', sans-serif; }
.row-body { flex: 1; min-width: 0; }

/* ─── Type/status pills ─── */
.pill {
    background: #E8F4FF; border: 1px solid #B8D8F0; color: #1A5A8A;
    border-radius: 4px; padding: 2px 8px; font-size: 10px; font-weight: 700;
    display: inline-block; font-family: 'Inter', sans-serif;
}
.pill.type-Civil    { background: #E8F4FF; border-color: #B8D8F0; color: #1A5A8A; }
.pill.type-Criminal { background: #FFF0F0; border-color: #F0B8B8; color: #8A1A1A; }
.pill.type-Family   { background: #FFF0FA; border-color: #F0B8E0; color: #7A1A5A; }
.pill.type-Consumer { background: #F0FFF4; border-color: #B8E8C8; color: #1A6A3A; }
.pill.type-Writ     { background: #F8F0FF; border-color: #D8B8F0; color: #4A1A8A; }
.pill.type-IP       { background: #FFF8E0; border-color: #E8D890; color: #7A5A00; }
.pill.type-Revenue  { background: #F4FFF0; border-color: #C0E0B0; color: #2A5A1A; }

.status {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; color: #6A6A6A; font-family: 'Inter', sans-serif;
}
.status::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: #22C55E; display: inline-block;
}
.status.status-Closed::before  { background: #94A3B8; }
.status.status-OnHold::before  { background: #F59E0B; }

/* ─── Toolbar (search/filter) ─── */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.toolbar .field { flex: 1; min-width: 200px; }
.input, .select, .textarea {
    background: #FEFCF5; border: 1px solid #D0C0A0;
    border-radius: 6px; padding: 9px 14px;
    font-size: 13px; outline: none; color: #1C1409;
    font-family: 'Inter', sans-serif;
    width: 100%;
}
.select { background: #FEFCF5; }
.textarea { min-height: 100px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: #C8920A; background: #FFFCE8; }

/* ─── Buttons ─── */
.btn {
    background: #C8920A; border: none; color: #fff;
    padding: 9px 20px; border-radius: 6px; font-size: 13px;
    font-weight: 600; white-space: nowrap; font-family: 'Inter', sans-serif;
}
.btn:hover { background: #A8780A; }
.btn-ghost { background: none; border: 1px solid #D0C0A0; color: #8A7A60; }
.btn-ghost:hover { background: #FFF8E8; color: #1C1409; }
.btn-dark { background: #1C1409; color: #F0E0B0; }
.btn-danger { background: #8A1A1A; color: #fff; }

/* ─── Item cards (list rows) ─── */
.item-list { display: grid; gap: 10px; }
.item {
    background: #FEFCF5; border: 1px solid #E0D4B0;
    border-radius: 8px; padding: 16px 20px;
    display: flex; align-items: center; gap: 16px;
    transition: all 0.14s;
}
.item:hover { border-color: #C8920A; background: #FFF8E8; }
.item-body { flex: 1; min-width: 0; }
.item-title { font-size: 14px; font-weight: 700; color: #1C1409; }
.item-sub { font-size: 12px; color: #8A7A60; margin-top: 2px; font-family: 'Inter', sans-serif; }
.item-meta-right { text-align: right; flex-shrink: 0; font-family: 'Inter', sans-serif; }
.item-meta-right .num { font-size: 13px; font-weight: 700; color: #1A6A3A; }
.item-meta-right .lbl { font-size: 11px; color: #8A7A60; }
.item-chev { color: #D0C0A0; font-size: 18px; flex-shrink: 0; }
.avatar {
    width: 44px; height: 44px; border-radius: 50%;
    background: #1C1409; color: #F0E0B0;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 700; flex-shrink: 0;
    font-family: 'Inter', sans-serif;
}

/* ─── Detail page ─── */
.back {
    background: none; border: 1px solid #D0C0A0; color: #8A7A60;
    padding: 6px 14px; border-radius: 6px; font-size: 12px;
    margin-bottom: 24px; font-family: 'Inter', sans-serif;
    display: inline-block;
}
.detail-card {
    background: #FEFCF5; border: 1px solid #E0D4B0;
    border-top: 3px solid var(--accent, #C8920A);
    border-radius: 8px; padding: 24px; margin-bottom: 20px;
}
.detail-card h2 { font-size: 22px; font-weight: 800; margin: 10px 0 6px; }
.detail-meta {
    display: flex; gap: 20px; flex-wrap: wrap;
    font-size: 13px; color: #6A5A40;
}
.next-date {
    display: inline-flex; align-items: center; gap: 8px;
    background: #FFF8E8; border: 1px solid #E0C060;
    border-radius: 6px; padding: 8px 14px; font-size: 12px;
    color: #8A5A00; font-weight: 600; margin-top: 12px;
    font-family: 'Inter', sans-serif;
}
.next-date strong { color: #C8920A; }

/* ─── Forms ─── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.form-group label, .field-label {
    display: block; font-size: 11px; color: #8A7A60;
    margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.08em;
    font-family: 'Inter', sans-serif;
}
.form-actions { display: flex; gap: 10px; margin-top: 20px; }
.form-error { color: #8A1A1A; font-size: 11px; margin-top: 4px; font-family: 'Inter', sans-serif; }
.form-error-list { background: #FFF0F0; border: 1px solid #F0B8B8; color: #8A1A1A;
    padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 12px; }

/* ─── Drafting ─── */
.template-grid {
    display: grid; gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.template-card {
    background: #FEFCF5; border: 1px solid #E0D4B0;
    border-left: 3px solid #C8920A;
    border-radius: 6px; padding: 14px;
    transition: all 0.14s; display: block;
}
.template-card:hover { background: #FFF8E8; border-color: #C8920A; }
.template-icon { font-size: 20px; margin-bottom: 6px; }
.template-cat {
    font-size: 11px; color: #C8920A; letter-spacing: 0.1em;
    text-transform: uppercase; margin-bottom: 4px;
    font-family: 'Inter', sans-serif;
}
.template-title { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.template-desc { font-size: 11px; color: #7A6A40; font-family: 'Inter', sans-serif; }

.draft-canvas {
    background: #fff; border: 1px solid #D8C890;
    border-radius: 8px; padding: 36px 44px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.05);
    font-family: 'Courier New', monospace;
    font-size: 13px; line-height: 1.85; white-space: pre-wrap; word-break: break-word;
}
.draft-toolbar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin-bottom: 20px;
}
.draft-toolbar-title { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 2px; }
.draft-toolbar-title strong { font-size: 14px; color: #1C1409; }
.draft-progress {
    display: flex; align-items: center; gap: 8px;
    font-size: 11px; color: #8A7A60; font-family: 'Inter', sans-serif;
}
.draft-progress-bar {
    width: 80px; height: 3px; background: #E0D4B0; border-radius: 2px; overflow: hidden;
}
.draft-progress-bar > div {
    height: 100%; background: #C8920A; width: 0;
    transition: width 0.3s;
}
.blank-input {
    border: none; border-bottom: 1px dashed #C8920A;
    background: #FFF9EE; color: #111;
    font-family: inherit; font-size: inherit; line-height: inherit;
    padding: 0 4px; outline: none; min-width: 100px;
}
.blank-input:focus { border-bottom: 2px solid #C8920A; background: #FFFCE8; }
.draft-note {
    margin-top: 12px; font-size: 11px; color: #8A7A60;
    padding: 10px 14px; background: #FFF8E0;
    border: 1px solid #E0C060; border-radius: 6px;
    font-family: 'Inter', sans-serif;
}

/* ─── Empty state ─── */
.empty { text-align: center; padding: 60px 0; color: #8A7A60; }
