/* ============================================================
   Design tokens
   Ink navy + brass postmark accent — the visual language of a
   delivery manifest, since this whole app is about tracked
   handoffs of work to clients.
   ============================================================ */
:root {
    --ink: #12233F;
    --ink-soft: #1B3358;
    --paper: #F4F5F6;
    --paper-raised: #FFFFFF;
    --line: #E1E4E8;
    --brass: #F2A93C;
    --brass-soft: #FCE7C2;
    --teal: #2F6F62;
    --brick: #B4432E;
    --text: #12233F;
    --text-muted: #5B6472;
    --radius: 6px;
    --font-display: 'Montserrat', -apple-system, sans-serif;
    --font-body: 'IBM Plex Sans', -apple-system, sans-serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--ink); }

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.01em;
    margin: 0 0 4px;
}

h1 { text-transform: uppercase; }

.mono { font-family: var(--font-mono); }

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

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--ink);
    color: #E7E5DD;
    padding: 28px 20px;
}

.sidebar .brand {
    margin-bottom: 32px;
}

.sidebar .brand .logo-badge {
    display: inline-block;
    background: #fff;
    padding: 10px 14px;
    border-radius: var(--radius);
    line-height: 0;
}

.sidebar .brand img {
    max-width: 100px;
    height: auto;
    display: block;
}

.sidebar .brand small {
    display: block;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--brass-soft);
    letter-spacing: 0.08em;
    margin-top: 10px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #9C9A90;
    text-decoration: none;
    font-size: 12px;
    margin-bottom: 20px;
}
.back-link:hover { color: #fff; }

.login-card .brand .logo-badge {
    display: inline-block;
    background: #fff;
    padding: 10px 14px;
    border-radius: var(--radius);
    line-height: 0;
    margin-bottom: 10px;
}

.login-card .brand img {
    max-width: 220px;
    height: auto;
    display: block;
}

.login-back-link {
    display: block;
    text-align: center;
    margin-top: 18px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
}
.login-back-link:hover { color: var(--ink); }

.sidebar nav a {
    display: block;
    color: #C9C7BD;
    text-decoration: none;
    font-size: 14px;
    padding: 9px 10px;
    border-radius: var(--radius);
    margin-bottom: 2px;
}

.sidebar nav a:hover { background: var(--ink-soft); color: #fff; }
.sidebar nav a.active { background: var(--ink-soft); color: #fff; border-left: 2px solid var(--brass); }

.sidebar .user-box {
    margin-top: 40px;
    padding-top: 16px;
    border-top: 1px solid var(--ink-soft);
    font-size: 12px;
    color: #9C9A90;
}

.sidebar .user-box a { color: var(--brass-soft); }

.main { flex: 1; padding: 36px 44px; max-width: 1100px; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 28px;
}

.page-header h1 { font-size: 28px; }
.page-header .subtitle { color: var(--text-muted); font-size: 14px; }

/* ---- Cards / stats ---- */
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.card {
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
}

.stat-label {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.stat-value {
    font-family: var(--font-display);
    font-size: 34px;
    margin-top: 6px;
}

/* ---- Postmark / stamp badge (signature element) ---- */
.stamp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 2px solid var(--brass);
    color: var(--brass);
    font-family: var(--font-mono);
    font-size: 9px;
    line-height: 1.1;
    text-align: center;
    flex-shrink: 0;
    transform: rotate(-6deg);
}

.stamp span { display: block; }
.stamp .day { font-size: 15px; font-weight: 600; }

/* ---- Tables / lists ---- */
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--line);
    padding: 10px 8px;
}
td { padding: 12px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
tr:last-child td { border-bottom: none; }

.tracking-code {
    font-family: var(--font-mono);
    font-size: 12px;
    background: var(--brass-soft);
    color: #7A5A20;
    padding: 2px 7px;
    border-radius: var(--radius);
}

.status-pill {
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.status-active { background: #E4EEEA; color: var(--teal); }
.status-on_hold { background: #F3E9DA; color: var(--brass); }
.status-completed { background: #EAEAEA; color: var(--text-muted); }

/* ---- Deliverable card ---- */
.deliverable {
    display: flex;
    gap: 16px;
    align-items: center;
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 10px;
}
.deliverable .info { flex: 1; }
.deliverable .title { font-weight: 600; margin-bottom: 2px; }
.deliverable .meta { color: var(--text-muted); font-size: 13px; }
.deliverable .btn { flex-shrink: 0; }

/* ---- Buttons / forms ---- */
.btn {
    display: inline-block;
    background: var(--ink);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: var(--ink-soft); }
.btn-brass { background: var(--brass); }
.btn-brass:hover { background: #9E7433; }
.btn-outline { background: transparent; border: 1px solid var(--line); color: var(--text); }

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; margin-top: 14px; }
input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 14px;
    background: #fff;
}
textarea { resize: vertical; min-height: 80px; }

.form-narrow { max-width: 420px; }

.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
}
.flash-success { background: #E4EEEA; color: var(--teal); }
.flash-error { background: #F5E4E0; color: var(--brick); }

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    font-size: 14px;
}

/* ---- Messages / chat ---- */
.message-thread { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.message-bubble {
    max-width: 65%;
    padding: 12px 15px;
    border-radius: var(--radius);
    font-size: 14px;
}
.message-bubble .sender { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 4px; }
.message-mine { align-self: flex-end; background: var(--ink); color: #fff; }
.message-mine .sender { color: var(--brass-soft); }
.message-theirs { align-self: flex-start; background: var(--paper-raised); border: 1px solid var(--line); }

/* ---- Login page ---- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ink);
}
.login-card {
    background: var(--paper);
    border-radius: var(--radius);
    padding: 40px 36px;
    width: 100%;
    max-width: 380px;
    text-align: center;
}
.login-card form {
    text-align: left;
}
.login-card .brand {
    font-family: var(--font-display);
    font-size: 24px;
    margin-bottom: 4px;
}
.login-card .brand small {
    display: block;
    font-family: var(--font-mono);
    font-size: 11px;
    margin-top: 0;
    color: var(--brass);
    letter-spacing: 0.08em;
    margin-bottom: 24px;
}

@media (max-width: 720px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; }
    .main { padding: 24px; }
    .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .message-bubble { max-width: 85%; }
}
