/* Reset & base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:              #f1f5f9;
    --surface:         #ffffff;
    --border:          #e2e8f0;
    --text:            #0f172a;
    --text-muted:      #64748b;
    --primary:         #4f46e5;
    --primary-hover:   #4338ca;
    --danger:          #ef4444;
    --danger-hover:    #dc2626;
    --success-bg:      #f0fdf4;
    --success-border:  #86efac;
    --success-text:    #166534;
    --error-bg:        #fef2f2;
    --error-border:    #fca5a5;
    --error-text:      #991b1b;
    --radius:          8px;
    --shadow:          0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:       0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
}

/* ─── Auth layout ─────────────────────────────────────────────────────── */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
    background: var(--bg);
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) * 1.5);
    box-shadow: var(--shadow-md);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
}

.auth-logo {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.auth-card h1 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -.02em;
    margin-bottom: 1.5rem;
}

.auth-subtitle {
    font-size: .875rem;
    color: var(--text-muted);
    margin-top: -.75rem;
    margin-bottom: 1.25rem;
}

.auth-back {
    display: block;
    margin-top: 1.25rem;
    font-size: .85rem;
    color: var(--text-muted);
    text-decoration: none;
    text-align: center;
}
.auth-back:hover { color: var(--text); }

/* ─── Site header ─────────────────────────────────────────────────────── */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.site-title {
    font-size: .85rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--primary);
}

.site-header nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.site-header nav a {
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: color .15s;
}
.site-header nav a:hover { color: var(--text); }

.nav-user {
    font-size: .875rem;
    color: var(--text-muted);
    padding-right: .5rem;
    border-right: 1px solid var(--border);
}

/* ─── Layout ──────────────────────────────────────────────────────────── */
.container {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

main.container {
    padding-top: 2rem;
    padding-bottom: 4rem;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -.02em;
    margin-bottom: 1.5rem;
}

/* ─── Cards ───────────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
}

.card h2 {
    font-size: .9rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

/* ─── Forms ───────────────────────────────────────────────────────────── */
.field {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
}

.field label {
    font-size: .825rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: .375rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.field input,
.field select,
.field textarea {
    font-family: inherit;
    font-size: .9375rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .5rem .75rem;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
    appearance: auto;
}

.field textarea {
    resize: vertical;
    min-height: 160px;
    line-height: 1.65;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.field-row-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.char-count {
    font-size: .775rem;
    font-weight: 400;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* ─── Buttons ─────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-size: .875rem;
    font-weight: 600;
    padding: .5rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background .15s, transform .08s;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
    height: 38px;
}
.btn:active { transform: translateY(1px); }

.btn-primary          { background: var(--primary);     color: #fff; }
.btn-primary:hover    { background: var(--primary-hover); }
.btn-danger           { background: var(--danger);      color: #fff; }
.btn-danger:hover     { background: var(--danger-hover); }
.btn-full             { width: 100%; }
.btn-sm               { height: 30px; padding: .25rem .75rem; font-size: .8rem; }

/* ─── Alerts ──────────────────────────────────────────────────────────── */
.alert {
    padding: .75rem 1rem;
    border-radius: var(--radius);
    font-size: .875rem;
    margin-bottom: 1rem;
}
.alert-error   { background: var(--error-bg);   border: 1px solid var(--error-border);   color: var(--error-text); }
.alert-success { background: var(--success-bg); border: 1px solid var(--success-border); color: var(--success-text); }

/* ─── Section divider ─────────────────────────────────────────────────── */
.section-divider {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 2rem 0 1.5rem;
    color: var(--text-muted);
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.section-divider::before,
.section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ─── Report cards ────────────────────────────────────────────────────── */
.report-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.5rem;
    margin-bottom: .875rem;
    transition: box-shadow .15s;
}
.report-card:hover { box-shadow: var(--shadow-md); }

.report-meta {
    display: flex;
    align-items: center;
    gap: .625rem;
    margin-bottom: .75rem;
    flex-wrap: wrap;
}

.report-date {
    font-weight: 700;
    font-size: .875rem;
    letter-spacing: -.01em;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: .175rem .6rem;
    background: #eef2ff;
    color: var(--primary);
    border-radius: 99px;
    font-size: .775rem;
    font-weight: 700;
    letter-spacing: .02em;
}

.badge-self {
    background: #f0fdf4;
    color: #166534;
}

.report-author {
    font-size: .8rem;
    color: var(--text-muted);
    margin-left: auto;
}

.report-content {
    font-size: .9125rem;
    line-height: 1.75;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text);
}

.empty-state {
    color: var(--text-muted);
    font-style: italic;
    padding: 3rem 0;
    text-align: center;
    font-size: .9rem;
}

/* ─── Table ───────────────────────────────────────────────────────────── */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

.table th {
    text-align: left;
    padding: .5rem .75rem;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}

.table td {
    padding: .75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }

.inline-select {
    font-family: inherit;
    font-size: .825rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: .25rem .5rem;
    cursor: pointer;
}
.inline-select:focus { outline: none; border-color: var(--primary); }

.text-muted { color: var(--text-muted); }

/* ─── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .field-row,
    .field-row-3  { grid-template-columns: 1fr; }
    .auth-card    { padding: 1.75rem; }
    .card         { padding: 1.25rem; }
    .report-author { display: none; }
}
