/* ==============================================================
   ORIGIN OS - interface stylesheet
   Premium, minimal, corporate. Plain CSS, no framework.
   ============================================================== */

:root {
    --ink:            #12151c;
    --ink-soft:       #1b2029;
    --ink-line:       #262c37;
    --paper:          #f6f7f9;
    --surface:        #ffffff;
    --line:           #e3e6ec;
    --line-soft:      #eef0f4;
    --text:           #1d2430;
    --text-muted:     #6b7484;
    --text-faint:     #98a0ae;
    --gold:           #c9a227;
    --gold-soft:      #f5efdb;
    --blue:           #2f5d8f;
    --green:          #1f7a4d;
    --green-soft:     #e6f4ec;
    --amber:          #a86a12;
    --amber-soft:     #fdf1dd;
    --red:            #a32b2b;
    --red-soft:       #fbeaea;
    --radius:         10px;
    --radius-sm:      6px;
    --shadow:         0 1px 2px rgba(18, 21, 28, .05), 0 8px 24px rgba(18, 21, 28, .05);
    --shadow-sm:      0 1px 2px rgba(18, 21, 28, .06);
    --sidebar-width:  248px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.3; }

hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* --- Layout --------------------------------------------------- */

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

.sidebar {
    width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    background: var(--ink);
    color: #cfd4dd;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
}

.sidebar__brand {
    padding: 22px 20px 18px;
    border-bottom: 1px solid var(--ink-line);
    color: #fff;
}

.sidebar__brand img { display: block; max-width: 100%; height: auto; }

/* Sidebar wordmark: drawn in CSS so it stays crisp at small sizes. */
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: #fff; }
.brand:hover { text-decoration: none; }
.brand__mark { width: 30px; height: 30px; flex: 0 0 30px; }
.brand__text { display: flex; flex-direction: column; line-height: 1; }

.brand__text strong {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 400;
    letter-spacing: .22em;
}

.brand__text em {
    font-style: normal;
    font-size: 8.5px;
    letter-spacing: .3em;
    color: #8d94a3;
    margin-top: 5px;
}

.sidebar__nav { padding: 14px 10px; overflow-y: auto; flex: 1; }

.sidebar__label {
    padding: 16px 12px 6px;
    font-size: 10px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: #6d7688;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: #cfd4dd;
    font-size: 13.5px;
    text-decoration: none;
    transition: background .12s ease, color .12s ease;
}

.sidebar__link:hover { background: var(--ink-soft); color: #fff; text-decoration: none; }

.sidebar__link.is-active {
    background: var(--ink-soft);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--gold);
}

.sidebar__link svg { width: 16px; height: 16px; flex: 0 0 16px; opacity: .8; }
.sidebar__link.is-active svg { opacity: 1; color: var(--gold); }

.sidebar__footer {
    padding: 14px 16px;
    border-top: 1px solid var(--ink-line);
    font-size: 11.5px;
    color: #6d7688;
}

.main {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 24px;
    height: 60px;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(140%) blur(6px);
    border-bottom: 1px solid var(--line);
}

.topbar__title {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 400;
    letter-spacing: .01em;
    margin-right: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar__user {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    color: var(--text-muted);
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--ink);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .04em;
}

.content { padding: 24px; max-width: 1440px; width: 100%; }

.page-head {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.page-head__text h1 {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 400;
}

.page-head__text p { margin: 4px 0 0; color: var(--text-muted); font-size: 13px; }
.page-head__actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.menu-toggle {
    display: none;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0;
    place-items: center;
}

/* --- Cards ---------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 18px;
}

.card__head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line-soft);
}

.card__head h2, .card__head h3 { font-size: 14px; letter-spacing: .01em; }
.card__head .spacer { margin-left: auto; }
.card__body { padding: 18px; }
.card__body--flush { padding: 0; }
.card__foot { padding: 12px 18px; border-top: 1px solid var(--line-soft); background: #fcfcfd; }

/* --- Stats ---------------------------------------------------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(184px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    display: block;
    color: inherit;
}

.stat:hover { text-decoration: none; border-color: #cfd5df; }

.stat__label {
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.stat__value {
    font-family: var(--font-display);
    font-size: 30px;
    line-height: 1.15;
    margin-top: 6px;
    font-weight: 400;
}

.stat__meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.stat--alert .stat__value { color: var(--red); }
.stat--accent { border-top: 2px solid var(--gold); }

/* --- Grids ---------------------------------------------------- */

.grid { display: grid; gap: 18px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid--sidebar { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }

/* --- Tables --------------------------------------------------- */

.table-wrap { width: 100%; overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

table.data th {
    text-align: left;
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-faint);
    font-weight: 600;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    background: #fcfcfd;
}

table.data td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}

table.data tbody tr:hover { background: #fafbfc; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .nowrap { white-space: nowrap; }
table.data .actions { text-align: right; white-space: nowrap; }

.row-strong { font-weight: 600; }
.row-sub { display: block; font-size: 12px; color: var(--text-muted); }

/* Completed tasks stay visible, struck through. */
.is-done .task-title { text-decoration: line-through; color: var(--text-faint); }
.is-done { background: #fcfcfd; }
.is-cancelled .task-title { text-decoration: line-through; color: var(--text-faint); }

/* --- Badges --------------------------------------------------- */

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .03em;
    background: var(--line-soft);
    color: var(--text-muted);
    white-space: nowrap;
}

.badge--green  { background: var(--green-soft); color: var(--green); }
.badge--amber  { background: var(--amber-soft); color: var(--amber); }
.badge--red    { background: var(--red-soft);   color: var(--red); }
.badge--gold   { background: var(--gold-soft);  color: #8a6f14; }
.badge--blue   { background: #e8eff7;           color: var(--blue); }
.badge--ink    { background: #e7e9ee;           color: var(--ink); }

/* --- Buttons -------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background .12s ease, border-color .12s ease, opacity .12s ease;
}

.btn:hover { background: #f7f8fa; text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

.btn--primary {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}
.btn--primary:hover { background: #1e242f; }

.btn--gold {
    background: var(--gold);
    border-color: var(--gold);
    color: #241d05;
}
.btn--gold:hover { background: #d8ad2a; }

.btn--danger { color: var(--red); border-color: #e8cfcf; }
.btn--danger:hover { background: var(--red-soft); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn--ghost:hover { background: var(--line-soft); }
.btn--sm { padding: 5px 10px; font-size: 12px; }
.btn--block { width: 100%; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

form.inline { display: inline; }

/* --- Forms ---------------------------------------------------- */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--wide { grid-column: 1 / -1; }

.field > label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--text-muted);
}

.field .hint { font-size: 11.5px; color: var(--text-faint); }
.field .error { font-size: 12px; color: var(--red); }

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=time], input[type=number], input[type=search], input[type=url],
input[type=file], select, textarea {
    width: 100%;
    padding: 9px 11px;
    font: inherit;
    font-size: 13.5px;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    transition: border-color .12s ease, box-shadow .12s ease;
}

textarea { min-height: 96px; resize: vertical; line-height: 1.5; }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #9fb4cd;
    box-shadow: 0 0 0 3px rgba(47, 93, 143, .12);
}

input.has-error, select.has-error, textarea.has-error { border-color: #d79a9a; }

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check input { width: auto; }

.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filters .field { min-width: 150px; }
.filters .field--search { min-width: 240px; flex: 1; }

/* --- Flash / alerts ------------------------------------------- */

.alert {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    margin-bottom: 14px;
    font-size: 13.5px;
}

.alert--success { background: var(--green-soft); border-color: #c6e5d3; color: #14603a; }
.alert--error   { background: var(--red-soft);   border-color: #eccfcf; color: #8a2020; }
.alert--info    { background: #eef3f9;           border-color: #d3e0ee; color: #26507c; }
.alert--warning { background: var(--amber-soft); border-color: #f0dcb8; color: #7d4f0c; }

/* --- Tabs ----------------------------------------------------- */

.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 18px;
    overflow-x: auto;
}

.tabs a {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    text-decoration: none;
}

.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.is-active { color: var(--ink); border-bottom-color: var(--gold); }
.tabs .count { font-size: 11px; color: var(--text-faint); }

/* --- Definition lists ----------------------------------------- */

.detail-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 24px; }
.detail-list div { min-width: 0; }
.detail-list dt {
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.detail-list dd { margin: 3px 0 0; word-break: break-word; }

/* --- Timeline ------------------------------------------------- */

.timeline { list-style: none; margin: 0; padding: 0; }

.timeline li {
    position: relative;
    padding: 0 0 16px 20px;
    border-left: 1px solid var(--line);
}

.timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }

.timeline li::before {
    content: "";
    position: absolute;
    left: -4.5px;
    top: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gold);
}

.timeline .t-action { font-weight: 600; font-size: 13.5px; }
.timeline .t-meta { font-size: 12px; color: var(--text-muted); }
.timeline .t-body { font-size: 13px; color: var(--text); margin-top: 2px; }

/* --- Notes ---------------------------------------------------- */

.note {
    padding: 13px 15px;
    border: 1px solid var(--line-soft);
    border-left: 2px solid var(--gold);
    border-radius: var(--radius-sm);
    background: #fcfcfd;
    margin-bottom: 10px;
}

.note__meta { font-size: 11.5px; color: var(--text-muted); margin-bottom: 5px; }
.note__body { white-space: pre-wrap; word-break: break-word; }

/* --- Pipeline board ------------------------------------------- */

.board {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(248px, 1fr);
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    align-items: start;
}

.board__col {
    background: #f1f3f6;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    min-height: 120px;
}

.board__head {
    padding: 11px 13px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.board__head h3 { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.board__head .count { font-size: 11px; color: var(--text-muted); margin-left: auto; }
.board__body { padding: 10px; display: flex; flex-direction: column; gap: 8px; }

.board__card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 11px 12px;
    box-shadow: var(--shadow-sm);
    display: block;
    color: inherit;
}

.board__card:hover { text-decoration: none; border-color: #cfd5df; }
.board__card .name { font-weight: 600; font-size: 13px; }
.board__card .meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.board__card .value { font-size: 12px; font-weight: 600; color: var(--ink); margin-top: 5px; }
.board__empty { padding: 12px; font-size: 12px; color: var(--text-faint); }

/* --- Login ---------------------------------------------------- */

.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(1000px 480px at 50% -10%, #1c2230 0%, var(--ink) 60%);
}

.auth__card {
    width: 100%;
    max-width: 408px;
    background: var(--surface);
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
    padding: 34px 32px 30px;
}

.auth__brand { text-align: center; margin-bottom: 22px; color: var(--ink); }
.auth__brand img { width: 190px; height: auto; }

.auth__title {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 400;
    text-align: center;
}

.auth__sub { text-align: center; color: var(--text-muted); font-size: 13px; margin: 4px 0 22px; }
.auth .field { margin-bottom: 14px; }
.auth__foot { margin-top: 18px; text-align: center; font-size: 11.5px; color: var(--text-faint); }

/* --- Misc ----------------------------------------------------- */

.empty {
    padding: 34px 18px;
    text-align: center;
    color: var(--text-muted);
}

.empty h3 { font-size: 14px; margin-bottom: 4px; }
.empty p { margin: 0 0 14px; font-size: 13px; }

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.right { text-align: right; }
.pre-wrap { white-space: pre-wrap; word-break: break-word; }

.pagination { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }

.status-page { max-width: 460px; margin: 12vh auto; text-align: center; }
.status-page .code { font-family: var(--font-display); font-size: 54px; color: var(--gold); }

/* --- Responsive ----------------------------------------------- */

@media (max-width: 1080px) {
    .grid--sidebar { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: 0 0 40px rgba(0, 0, 0, .3);
    }

    body.nav-open .sidebar { transform: translateX(0); }
    .main { margin-left: 0; }
    .menu-toggle { display: grid; }
    .content { padding: 16px; }
    .topbar { padding: 0 16px; }
    .topbar__user .who { display: none; }

    body.nav-open::after {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .4);
        z-index: 35;
    }
}

@media (max-width: 560px) {
    .page-head__actions { width: 100%; }
    .page-head__actions .btn { flex: 1; }
    .stat__value { font-size: 26px; }
    .filters .field, .filters .field--search { min-width: 100%; }
}

@media print {
    .sidebar, .topbar, .page-head__actions, .btn { display: none !important; }
    .main { margin: 0; }
    body { background: #fff; }
}
