/* LegalTrack — shared design system */

:root {
    --bg: #f7f8fc;
    --white: #ffffff;
    --ink: #111827;
    --ink2: #374151;
    --ink3: #6b7280;
    --border: #e5e7eb;
    --accent: #1a3a5c;
    --accent2: #e8f0f8;
    --accent3: #c5d8ed;
    --gold: #b45309;
    --gold2: #fef3c7;
    --green: #065f46;
    --green2: #d1fae5;
    --green3: #10b981;
    --red: #991b1b;
    --red2: #fee2e2;
    --orange: #92400e;
    --orange2: #fde68a;
    --purple: #4c1d95;
    --purple2: #ede9fe;
    --locked: #9ca3af;
    --locked-bg: #f9fafb;
    --sidebar: #111827;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.65;
}

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

h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 6px; }

*:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--white);
    color: var(--ink);
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #14304d; }
.btn-outline { background: #fff; border-color: var(--border); color: var(--ink2); }
.btn-danger { background: var(--red2); color: var(--red); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 13px; }
.alert-error { background: var(--red2); color: var(--red); }
.alert-success { background: var(--green2); color: var(--green); }
.alert-warning { background: var(--orange2); color: var(--orange); }
.alert-info { background: var(--accent2); color: var(--accent); }

/* ---------- Login page ---------- */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #0f1f35, #1a3a5c);
}
.login-wrap { width: 100%; padding: 20px; }
.login-card {
    background: var(--white);
    max-width: 400px;
    margin: 0 auto;
    padding: 40px 32px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-logo {
    width: 56px; height: 56px; border-radius: 14px;
    background: var(--accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 20px; margin: 0 auto 14px;
}
.login-sub { color: var(--ink3); margin: 4px 0 0; }
.login-form label { display: block; font-weight: 600; margin: 14px 0 6px; }
.login-form input {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 14px;
}
.login-footnote { text-align: center; color: var(--ink3); font-size: 12px; margin-top: 20px; }

/* ---------- Forms (shared by modals) ---------- */
label { display: block; font-weight: 600; margin: 12px 0 6px; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=url], select, textarea {
    width: 100%; padding: 9px 11px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 13px; font-family: inherit; background: #fff;
}
textarea { resize: vertical; }

/* ---------- Panels / cards ---------- */
.panel {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}
.panel-warning { background: var(--orange2); border-color: #f5cf7e; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 16px; text-align: center; }
.stat-card-alert { background: var(--red2); border-color: #f3b9b9; }
.stat-value { font-size: 24px; font-weight: 800; color: var(--accent); }
.stat-label { color: var(--ink3); font-size: 12px; margin-top: 4px; }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--ink3); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: var(--bg); }
.empty-cell { text-align: center; color: var(--ink3); padding: 24px !important; }
.notes-cell { max-width: 240px; }
.row-actions { display: flex; gap: 6px; white-space: nowrap; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge-green { background: var(--green2); color: var(--green); }
.badge-red { background: var(--red2); color: var(--red); }
.badge-blue { background: var(--accent2); color: var(--accent); }
.badge-grey { background: #f3f4f6; color: var(--ink3); }
.badge-purple { background: var(--purple2); color: var(--purple); }

.type-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.type-research { background: var(--accent2); color: var(--accent); }
.type-drafting { background: var(--purple2); color: var(--purple); }
.type-analysis { background: var(--green2); color: var(--green); }
.type-judgment { background: var(--gold2); color: var(--gold); }
.type-project { background: var(--orange2); color: var(--orange); }
.type-reflection { background: #f3f4f6; color: var(--ink3); }

/* ---------- Progress bars ---------- */
.progress-bar { background: var(--locked-bg); border-radius: 20px; height: 8px; overflow: hidden; flex: 1; min-width: 60px; }
.progress-bar-fill { background: var(--green3); height: 100%; border-radius: 20px; transition: width 0.3s; }
.progress-label { font-size: 11px; color: var(--ink3); margin-left: 6px; }
.metric { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.metric > span:first-child { min-width: 130px; font-size: 12px; color: var(--ink2); }
.metric-row .metric { margin-bottom: 14px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tab-btn { background: none; border: none; padding: 10px 16px; font-weight: 600; color: var(--ink3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; font-size: 13px; }
.tab-btn.active { color: var(--accent); border-color: var(--accent); }
a.tab-btn { display: inline-block; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ---------- Filters ---------- */
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; }
.filter-row select { width: auto; }
.filter-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.filter-tab { padding: 7px 14px; border-radius: 8px; background: var(--white); border: 1px solid var(--border); color: var(--ink2); font-weight: 600; font-size: 13px; }
.filter-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- Modals ---------- */
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(17,24,39,0.5);
    align-items: center; justify-content: center; z-index: 1000; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--white); border-radius: 16px; padding: 28px;
    width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto;
}
.modal-wide { max-width: 640px; }
.modal-sub { color: var(--ink3); margin-top: -6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.review-box p { margin: 4px 0; }

/* ---------- Notifications ---------- */
.notif-bell { position: relative; background: none; border: none; font-size: 16px; cursor: pointer; color: inherit; }
.notif-count { position: absolute; top: -4px; right: -8px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 10px; }
.notif-dropdown {
    position: absolute; background: #fff; border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12); width: 280px; max-height: 320px; overflow-y: auto; z-index: 50;
}
.notif-item { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 12px; }
.notif-item.unread { background: var(--accent2); }
.notif-ts { color: var(--ink3); font-size: 10px; }
.notif-empty { padding: 16px; text-align: center; color: var(--ink3); font-size: 12px; }

/* ---------- Milestones ---------- */
.milestone-list { list-style: none; margin: 0; padding: 0; }
.milestone-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.milestone-status { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); background: #fff; cursor: pointer; flex-shrink: 0; }
.milestone-in_progress { background: var(--gold2); border-color: var(--gold); }
.milestone-done { background: var(--green3); border-color: var(--green3); }
span.milestone-status { cursor: default; }
