/* TrackFlow — Warm Studio design system */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500&family=DM+Mono:wght@400&display=swap');

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

:root {
    --bg:         #FDFAF6;
    --bg2:        #FFF8F2;
    --bg3:        #FDF8F3;
    --border:     #E8DDD0;
    --border2:    #D0C4B8;
    --text:       #2C1F14;
    --text2:      #5A4030;
    --text3:      #A08070;
    --accent:     #C4622D;
    --accent-d:   #993C1D;
    --accent-bg:  #FAECE7;
    --green:      #2A6B4A;
    --green-bg:   #E1F5EE;
    --amber:      #854F0B;
    --amber-bg:   #FAEEDA;
    --red:        #A32D2D;
    --red-bg:     #FCEBEB;
    --blue:       #185FA5;
    --blue-bg:    #E6F1FB;
    --font:       'DM Sans', sans-serif;
    --mono:       'DM Mono', monospace;
    --r-sm:       6px;
    --r-md:       8px;
    --r-lg:       12px;
    --r-xl:       16px;
}

body { font-family: var(--font); background: var(--bg3); color: var(--text); font-size: 14px; line-height: 1.6; }

/* Layout */
.tf-shell { display: flex; flex-direction: column; min-height: 100vh; }
.tf-nav { background: var(--bg); border-bottom: 0.5px solid var(--border); padding: 0 1.5rem; height: 54px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; }
.tf-nav-logo { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 500; color: var(--text); text-decoration: none; }
.tf-nav-logo-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tf-nav-right { display: flex; align-items: center; gap: 10px; }
.tf-layout { display: flex; flex: 1; }
.tf-sidebar { width: 220px; background: var(--bg3); border-right: 0.5px solid var(--border); padding: 1.25rem 0; flex-shrink: 0; min-height: calc(100vh - 54px); position: sticky; top: 54px; align-self: flex-start; height: calc(100vh - 54px); overflow-y: auto; }
.tf-main { flex: 1; padding: 2rem; max-width: 900px; }

/* Sidebar */
.sb-section { margin-bottom: 1.5rem; }
.sb-label { font-size: 10px; font-weight: 500; color: var(--text3); letter-spacing: .07em; text-transform: uppercase; padding: 0 1rem; margin-bottom: 5px; display: block; }
.sb-item { display: flex; align-items: center; gap: 9px; padding: 7px 1rem; font-size: 13px; color: var(--text2); cursor: pointer; border-right: 2px solid transparent; text-decoration: none; transition: background .12s; }
.sb-item:hover { background: #F9F2EA; }
.sb-item.active { background: #F5EBE0; color: var(--text); font-weight: 500; border-right-color: var(--accent); }
.sb-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.sb-chip { margin-left: auto; font-size: 10px; padding: 1px 6px; border-radius: 8px; }
.sb-chip-warn { background: var(--amber-bg); color: var(--amber); }
.sb-chip-norm { background: var(--accent-bg); color: var(--accent-d); }
.sb-chip-ok   { background: var(--green-bg); color: var(--green); }

/* Cards & containers */
.card { background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--r-lg); padding: 1.25rem; margin-bottom: 1rem; }
.card.warn { border-color: #FAC775; background: #FFFBF2; }
.card.over { border-color: #F09595; background: #FFF5F5; }
.card.success { border-color: #97C459; background: var(--green-bg); }

/* Page header */
.page-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.page-title { font-size: 18px; font-weight: 500; color: var(--text); }
.page-sub { font-size: 13px; color: var(--text3); margin-top: 2px; }

/* Stat grid */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 1.5rem; }
.stat-card { background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--r-md); padding: .875rem 1rem; }
.stat-val { font-size: 22px; font-weight: 500; color: var(--text); }
.stat-val.green { color: var(--green); }
.stat-val.amber { color: var(--amber); }
.stat-val.red   { color: var(--red); }
.stat-lbl { font-size: 12px; color: var(--text3); margin-top: 2px; }

/* Pills / status */
.pill { font-size: 11px; font-weight: 500; padding: 2px 9px; border-radius: 10px; display: inline-block; white-space: nowrap; }
.pill-draft    { background: #F0E8DF; color: #7A5A40; }
.pill-review   { background: var(--amber-bg); color: var(--amber); }
.pill-edit     { background: var(--red-bg); color: var(--red); }
.pill-admin    { background: var(--blue-bg); color: var(--blue); }
.pill-acct     { background: #EDE8FE; color: #3C3489; }
.pill-paid     { background: var(--green-bg); color: var(--green); }
.pill-active   { background: var(--green-bg); color: var(--green); }
.pill-warn     { background: var(--amber-bg); color: var(--amber); }
.pill-over     { background: var(--red-bg); color: var(--red); }

/* Tables */
.tf-table { width: 100%; border-collapse: collapse; }
.tf-table th { font-size: 11px; font-weight: 500; color: var(--text3); text-align: left; padding: 6px 0; border-bottom: 0.5px solid var(--border); }
.tf-table td { font-size: 13px; color: var(--text); padding: 10px 0; border-bottom: 0.5px solid #F0E8DF; vertical-align: middle; }
.tf-table tr:last-child td { border-bottom: none; }
.tf-table td.muted { color: var(--text3); }
.tf-table td.mono  { font-family: var(--mono); font-size: 12px; }
.tf-table td.right { text-align: right; }

/* Rows */
.row-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 0.5px solid #F0E8DF; }
.row-item:last-child { border-bottom: none; }
.row-body { flex: 1; min-width: 0; }
.row-title { font-size: 13px; color: var(--text); }
.row-sub   { font-size: 11px; color: var(--text3); }
.row-val   { font-size: 13px; font-weight: 500; color: var(--text2); text-align: right; }

/* Forms */
label.tf-label { display: block; font-size: 12px; color: var(--text2); margin-bottom: 5px; }
input.tf-input, select.tf-select, textarea.tf-textarea {
    width: 100%; padding: 8px 10px; font-size: 13px; font-family: var(--font);
    border: 0.5px solid var(--border); border-radius: var(--r-sm);
    background: var(--bg); color: var(--text); outline: none; transition: border-color .15s;
}
input.tf-input:focus, select.tf-select:focus, textarea.tf-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(196,98,45,.1); }
input.tf-input.err { border-color: var(--red); }
.tf-form-group { margin-bottom: 14px; }
.tf-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tf-form-note { font-size: 11px; color: var(--text3); margin-top: 4px; }
.tf-form-err  { font-size: 11px; color: var(--red); margin-top: 4px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: var(--r-md); font-size: 13px; font-weight: 500; font-family: var(--font); cursor: pointer; border: none; transition: opacity .15s, transform .1s; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover  { background: var(--accent-d); }
.btn-dark     { background: var(--text); color: #fff; }
.btn-dark:hover { opacity: .85; }
.btn-outline  { background: var(--bg2); color: var(--text2); border: 0.5px solid var(--border); }
.btn-outline:hover { background: #F5EBE0; }
.btn-success  { background: var(--green); color: #fff; }
.btn-success:hover { opacity: .87; }
.btn-danger   { background: var(--bg2); color: var(--red); border: 0.5px solid #F0C8C8; }
.btn-danger:hover { background: var(--red-bg); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-link { background: none; border: none; color: var(--accent); font-size: 12px; cursor: pointer; padding: 0; font-family: var(--font); }
.btn-link:hover { text-decoration: underline; }

/* Timer hero */
.timer-hero { background: var(--text); border-radius: var(--r-xl); padding: 1.5rem; margin-bottom: 1.5rem; display: flex; align-items: center; justify-content: space-between; }
.timer-badge { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.08); border-radius: 6px; padding: 3px 10px; font-size: 12px; color: #D4B8A0; margin-bottom: 8px; }
.timer-clock { font-size: 42px; font-weight: 500; color: #FDFAF6; letter-spacing: -2px; font-variant-numeric: tabular-nums; line-height: 1; }
.timer-meta  { font-size: 12px; color: #8A7060; margin-top: 6px; }
.timer-stop  { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background .15s; }
.timer-stop:hover { background: var(--accent-d); }
.timer-idle  { background: var(--text); border-radius: var(--r-xl); padding: 1.5rem; margin-bottom: 1.5rem; }
.timer-idle-text { font-size: 15px; color: #D4B8A0; margin-bottom: 1rem; }

/* Invoice workflow steps */
.wf-steps { display: flex; align-items: flex-start; margin: 1rem 0; }
.wf-step { flex: 1; text-align: center; position: relative; }
.wf-step:not(:last-child)::after { content: ''; position: absolute; top: 14px; left: 55%; width: 90%; height: 0.5px; background: var(--border); }
.wf-circle { width: 28px; height: 28px; border-radius: 50%; margin: 0 auto 6px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 500; }
.wf-circle.done { background: var(--accent); color: #fff; }
.wf-circle.active { background: var(--text); color: #fff; }
.wf-circle.wait { background: #F0E8DF; color: var(--text3); }
.wf-label { font-size: 11px; color: var(--text3); }
.wf-label.active { color: var(--text); font-weight: 500; }

/* Avatar */
.av { border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 500; flex-shrink: 0; }
.av-sm { width: 28px; height: 28px; font-size: 11px; }
.av-md { width: 36px; height: 36px; font-size: 13px; }

/* Nav user button */
.nav-user { display: flex; align-items: center; gap: 8px; border: 0.5px solid var(--border); border-radius: var(--r-md); padding: 5px 10px; background: none; cursor: pointer; font-size: 12px; color: var(--text2); text-decoration: none; }
.nav-user:hover { background: var(--bg2); }

/* Role badge */
.role-badge { font-size: 10px; font-weight: 500; padding: 2px 8px; border-radius: 8px; }
.rb-admin       { background: var(--accent-bg); color: var(--accent-d); }
.rb-accounting  { background: var(--amber-bg); color: var(--amber); }
.rb-contractor  { background: var(--green-bg); color: var(--green); }

/* Alert / info box */
.alert { display: flex; align-items: flex-start; gap: 8px; border-radius: var(--r-md); padding: 10px 12px; margin-bottom: 1rem; font-size: 13px; }
.alert-dot { width: 6px; height: 6px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.alert-warn { background: var(--amber-bg); border: 0.5px solid #FAC775; color: #633806; }
.alert-warn .alert-dot { background: var(--amber); }
.alert-success { background: var(--green-bg); border: 0.5px solid #97C459; color: #27500A; }
.alert-success .alert-dot { background: var(--green); }
.alert-danger { background: var(--red-bg); border: 0.5px solid #F09595; color: var(--red); }
.alert-danger .alert-dot { background: var(--red); }
.alert-info { background: var(--blue-bg); border: 0.5px solid #85B7EB; color: var(--blue); }
.alert-info .alert-dot { background: var(--blue); }

/* Hour bar */
.hour-bar-wrap { margin: 8px 0 5px; }
.hour-bar-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text3); margin-bottom: 4px; }
.hour-bar-bg { height: 6px; background: var(--border); border-radius: 3px; }
.hour-bar-fill { height: 6px; border-radius: 3px; transition: width .3s; }

/* Notification dot */
.notif-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 5px; vertical-align: middle; }

/* Upload zone */
.upload-zone { border: 0.5px dashed var(--border2); border-radius: var(--r-md); padding: 1.5rem; text-align: center; color: var(--text3); font-size: 13px; cursor: pointer; background: var(--bg2); transition: background .15s; }
.upload-zone:hover { background: #F5EBE0; }

/* Flash messages */
.flash { padding: 10px 14px; border-radius: var(--r-md); margin-bottom: 1rem; font-size: 13px; }
.flash-success { background: var(--green-bg); color: #27500A; border: 0.5px solid #97C459; }
.flash-error   { background: var(--red-bg); color: var(--red); border: 0.5px solid #F09595; }

/* Contractor project tag */
.ctag { font-size: 11px; background: #F0E8DF; color: var(--text2); padding: 2px 8px; border-radius: 6px; }

/* Responsive */
@media (max-width: 768px) {
    .tf-sidebar { display: none; }
    .tf-form-row { grid-template-columns: 1fr; }
    .timer-clock { font-size: 30px; }
}
