/* ===========================================================================
   CirrusVPS Job Management — slate blue-grey theme
   ========================================================================= */

:root {
    --bg:            #e9edf2;
    --surface:       #ffffff;
    --surface-2:     #f3f5f8;
    --border:        #d2d9e3;
    --border-strong: #b9c3d1;

    --text:          #1f2937;
    --text-muted:    #64748b;
    --text-faint:    #94a3b8;

    --primary:       #4a5b73;
    --primary-dark:  #3a4a5e;
    --primary-light: #e6ebf1;
    --accent:        #5b7fa6;

    --danger:        #b1454a;
    --danger-bg:     #f8e7e8;
    --success:       #3f7d5a;
    --success-bg:    #e6f1ea;
    --warning:       #9a7327;
    --warning-bg:    #f6eed9;
    --info-bg:       #e6ecf2;

    --radius:    8px;
    --radius-sm: 5px;
    --shadow:    0 1px 2px rgba(31, 42, 55, .06), 0 2px 8px rgba(31, 42, 55, .07);
    --shadow-lg: 0 8px 28px rgba(31, 42, 55, .16);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 { margin: 0 0 .4em; font-weight: 600; color: var(--primary-dark); }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }

/* --- Top bar -------------------------------------------------------------- */
.topbar {
    display: flex;
    align-items: center;
    gap: 28px;
    background: var(--primary-dark);
    color: #eef1f5;
    padding: 0 24px;
    height: 58px;
    box-shadow: var(--shadow);
}

.brand {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: .2px;
    white-space: nowrap;
}
.brand span {
    color: #a9bdd4;
    font-weight: 400;
    margin-left: 4px;
}

.mainnav {
    display: flex;
    gap: 4px;
    flex: 1;
}
.mainnav a {
    color: #c4cedd;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: background .12s, color .12s;
}
.mainnav a:hover   { background: rgba(255, 255, 255, .08); color: #fff; }
.mainnav a.active  { background: rgba(255, 255, 255, .14); color: #fff; }

.userbox {
    display: flex;
    align-items: center;
    gap: 10px;
}
.userbox-id { text-align: right; line-height: 1.25; }
.userbox-name { display: block; font-weight: 600; font-size: .9rem; }
.userbox-role { display: block; font-size: .72rem; color: #a9bdd4; text-transform: uppercase; letter-spacing: .5px; }

/* --- Layout --------------------------------------------------------------- */
.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 26px 24px 60px;
}

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}
.page-head .sub { color: var(--text-muted); margin: 0; }

.sitefooter {
    text-align: center;
    color: var(--text-faint);
    font-size: .8rem;
    padding: 24px;
}

.breadcrumb {
    font-size: .85rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.breadcrumb a { color: var(--text-muted); }

/* --- Cards ---------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: -4px 0 14px;
}
.card-head h2, .card-head h3 { margin: 0; }
.card.compact { padding: 14px 16px; }
.muted { color: var(--text-muted); }
.empty {
    color: var(--text-muted);
    text-align: center;
    padding: 26px 10px;
    font-style: italic;
}

/* --- Stat tiles ----------------------------------------------------------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px;
}
.stat .num { font-size: 1.9rem; font-weight: 700; color: var(--primary-dark); line-height: 1.1; }
.stat .lbl { color: var(--text-muted); font-size: .85rem; margin-top: 2px; }
.stat.accent-warn    { border-left-color: var(--warning); }
.stat.accent-success { border-left-color: var(--success); }
.stat.accent-danger  { border-left-color: var(--danger); }

/* --- Buttons -------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font: inherit;
    font-weight: 600;
    line-height: 1;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background .12s, border-color .12s, opacity .12s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost {
    background: transparent;
    color: #dde3ec;
    border-color: rgba(255, 255, 255, .25);
}
.btn-ghost:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.btn-outline {
    background: var(--surface);
    color: var(--primary);
    border-color: var(--border-strong);
}
.btn-outline:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .88; }
.btn-sm { padding: 6px 11px; font-size: .82rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

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

/* --- Forms ---------------------------------------------------------------- */
label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 5px; color: var(--primary-dark); }
.field { margin-bottom: 14px; }
.field .hint { font-weight: 400; font-size: .78rem; color: var(--text-muted); }

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=search], select, textarea {
    width: 100%;
    font: inherit;
    color: var(--text);
    padding: 9px 11px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
}
/* Single-line controls share one explicit height so selects and inputs match. */
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=search], select {
    height: 42px;
    line-height: 1.2;
}
textarea { resize: vertical; min-height: 70px; height: auto; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(91, 127, 166, .18);
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0 16px;
}
.form-grid .span-2 { grid-column: 1 / -1; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.inline-form .field { margin-bottom: 0; }
fieldset { border: none; padding: 0; margin: 0; }
fieldset:disabled { opacity: .65; }

/* --- Tables --------------------------------------------------------------- */
.table {
    width: 100%;
    border-collapse: collapse;
}
.table th, .table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table th {
    font-size: .73rem;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-muted);
    background: var(--surface-2);
}
.table tbody tr:hover { background: var(--surface-2); }
.table tr:last-child td { border-bottom: none; }
.table .num { text-align: right; }
.row-link { cursor: pointer; }
.table-wrap { overflow-x: auto; }

/* --- Badges --------------------------------------------------------------- */
.badge {
    display: inline-block;
    font-size: .73rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    white-space: nowrap;
}
.badge-open        { background: var(--info-bg);    color: #3a4a5e; }
.badge-in_progress { background: #e2ebf4;           color: #345377; }
.badge-on_hold     { background: var(--warning-bg); color: var(--warning); }
.badge-completed,
.badge-done        { background: var(--success-bg); color: var(--success); }
.badge-cancelled   { background: #e7e9ec;           color: #6b7280; }
.badge-todo        { background: #e7e9ec;           color: #54607a; }
.badge-low         { background: #e7e9ec;           color: #6b7280; }
.badge-normal      { background: var(--info-bg);    color: #3a4a5e; }
.badge-high        { background: var(--warning-bg); color: var(--warning); }
.badge-urgent      { background: var(--danger-bg);  color: var(--danger); }
.badge-role        { background: var(--primary-light); color: var(--primary-dark); }
.badge-invoiced    { background: var(--success-bg); color: var(--success); }
.badge-muted       { background: #e7e9ec;           color: #6b7280; }

/* --- Alerts --------------------------------------------------------------- */
.alert {
    padding: 11px 15px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    border: 1px solid transparent;
    font-size: .92rem;
}
.alert-success { background: var(--success-bg); border-color: #bcd9c7; color: #2f6045; }
.alert-error   { background: var(--danger-bg);  border-color: #e2bdbf; color: #8f3539; }
.alert-info    { background: var(--info-bg);    border-color: #c6d2df; color: #3a4a5e; }

/* --- Progress ------------------------------------------------------------- */
.progress {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 20px;
    height: 9px;
    overflow: hidden;
    min-width: 90px;
}
.progress > span {
    display: block;
    height: 100%;
    background: var(--accent);
}
.progress > span.full { background: var(--success); }

/* --- Misc ----------------------------------------------------------------- */
.split {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    align-items: start;
}
.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; }
.dl dt { color: var(--text-muted); font-size: .85rem; }
.dl dd { margin: 0; }
.tag-archived { color: var(--text-faint); font-style: italic; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.mt { margin-top: 16px; }

.filterbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-end;
    margin-bottom: 16px;
}
/* Filter / Search / Reset / Clear controls match the 42px input height. */
.filterbar .btn { height: 42px; }

/* --- Auth pages ----------------------------------------------------------- */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}
.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    padding: 30px 30px 26px;
}
.auth-brand {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 4px;
}
.auth-brand span { color: var(--accent); }
.auth-sub {
    text-align: center;
    color: var(--text-muted);
    font-size: .9rem;
    margin-bottom: 22px;
}

/* --- Tasks & invoicing --------------------------------------------------- */
.task {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    padding: 14px 16px;
    margin-bottom: 12px;
}
.task-new {
    background: var(--primary-light);
    border-style: dashed;
}
.task-new h3 { margin-bottom: 10px; }
.task-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.task-title { flex: 1; font-weight: 600; }
.task-actions { display: flex; gap: 8px; margin-top: 4px; }
.task fieldset { margin-bottom: 8px; }

.invoice-pick {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    max-height: 230px;
    overflow-y: auto;
}
.pick {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    font-weight: 400;
    margin: 0;
    cursor: pointer;
}
.pick:last-child { border-bottom: none; }
.pick:hover { background: var(--surface-2); }
.pick input { width: auto; }
.pick span:nth-child(2) { flex: 1; }

.invoice {
    border: 1px solid var(--border);
    border-left: 4px solid var(--success);
    border-radius: var(--radius-sm);
    background: var(--surface);
    padding: 12px 14px;
    margin-bottom: 10px;
}
.invoice-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}
.invoice-tasks {
    margin: 4px 0;
    padding-left: 20px;
    font-size: .9rem;
}
.invoice-tasks li { margin: 2px 0; }
.invoice-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: .82rem;
    margin-top: 8px;
    border-top: 1px solid var(--border);
    padding-top: 7px;
}

@media (max-width: 760px) {
    .split { grid-template-columns: 1fr; }
    .topbar { gap: 14px; padding: 0 14px; }
    .userbox-id { display: none; }
    .container { padding: 18px 14px 50px; }
}
