/* =============================================================
   style.css — Time Tracker
   Colour variables live in theme.css
   ============================================================= */

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

/* ---- Base body ---- */
body {
    font-family: system-ui, -apple-system, sans-serif;
    background: #f1f5f9;
    color: #1e293b;
    min-height: 100vh;
}
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- Header ---- */
header { background: var(--primary); color: #fff; padding: 0 1.5rem; }
.header-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    gap: 1rem;
}
.logo { font-size: 1.1rem; font-weight: 700; letter-spacing: -.3px; color: #fff; white-space: nowrap; }

/* End-user nav */
.nav-links { display: flex; gap: .2rem; }
.nav-link {
    color: rgba(255,255,255,.7);
    text-decoration: none;
    padding: .3rem .7rem;
    font-size: .875rem;
    border-radius: 4px;
    transition: color .12s, background .12s;
    white-space: nowrap;
}
.nav-link:hover  { color: #fff; background: rgba(255,255,255,.12); }
.nav-link.active { color: #fff; background: rgba(255,255,255,.18); font-weight: 500; }

/* Admin header links */
.header-links a       { color: var(--primary-tint-text); text-decoration: none; font-size: .85rem; }
.header-links a:hover { color: #fff; }

.user-info        { font-size: .85rem; opacity: .9; white-space: nowrap; }
.user-info a       { color: var(--primary-tint-text); text-decoration: none; }
.user-info a:hover { color: #fff; }

/* ---- Main container ---- */
main { max-width: 960px; margin: 0 auto; padding: 1.5rem; }

/* ---- Flash messages ---- */
.flash { padding: .7rem 1rem; border-radius: 6px; margin-bottom: 1.25rem; font-size: .875rem; }
.flash-error   { background: #fef2f2; border: 1px solid #fca5a5; color: #b91c1c; }
.flash-success { background: #f0fdf4; border: 1px solid #86efac; color: #15803d; }

/* ---- Cards (admin panels, quick, import) ---- */
.card { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; margin-bottom: 1.25rem; }
.card-header { padding: .75rem 1rem; background: #f8fafc; border-bottom: 1px solid #e2e8f0; font-weight: 600; font-size: .9rem; color: #334155; }
.card-body { padding: 1rem; }

/* ---- List table (admin panels) ---- */
.list-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.list-table th {
    padding: .45rem .75rem;
    text-align: left;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
    font-weight: 600;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.list-table td { padding: .55rem .75rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.list-table tbody tr:last-child td { border-bottom: none; }
.list-table tbody tr:hover td { background: #fafafa; }
.td-actions { text-align: right; width: 100px; }
.td-num { text-align: right; font-variant-numeric: tabular-nums; }
.empty-row td { text-align: center; color: #94a3b8; padding: 1.5rem; font-size: .875rem; }

/* ---- Entry table (week view & admin sheet) ---- */
.entry-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.entry-table thead tr { background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.entry-table th {
    padding: .45rem .75rem;
    text-align: left;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
    font-weight: 600;
}
.entry-table td { padding: .5rem .75rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.entry-table tbody tr:last-child td { border-bottom: none; }
.entry-table tbody tr:hover td { background: #fafafa; }
.col-customer { width: 160px; }
.col-desc     { width: auto; }
.col-hours    { width: 75px; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 500; }
.col-bill     { width: 80px; text-align: center; }
.col-actions  { width: 120px; text-align: right; }
.col-user     { width: 110px; font-size: .82rem; color: #475569; }
.center       { text-align: center; }

/* ---- Form inputs ---- */
.input-customer {
    padding: .4rem .6rem;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    font-size: .875rem;
    color: #1e293b;
    background: #fff;
    min-width: 130px;
    max-width: 180px;
}
.input-desc {
    flex: 1;
    min-width: 180px;
    padding: .4rem .6rem;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    font-size: .875rem;
    color: #1e293b;
}
.input-hours {
    width: 75px;
    padding: .4rem .6rem;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    font-size: .875rem;
    color: #1e293b;
}
.input-customer:focus, .input-desc:focus, .input-hours:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 2px var(--focus-ring);
}
.bill-label { display: flex; align-items: center; gap: .3rem; font-size: .85rem; color: #475569; white-space: nowrap; cursor: pointer; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    padding: .35rem .7rem;
    border-radius: 5px;
    font-size: .8rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background .12s, border-color .12s;
    white-space: nowrap;
    line-height: 1.4;
}
.btn-nav     { background: #fff; border-color: #cbd5e1; color: #374151; }
.btn-nav:hover { background: #f1f5f9; border-color: #94a3b8; }
.btn-disabled { background: #f1f5f9; border-color: #e2e8f0; color: #cbd5e1; cursor: default; display: inline-flex; align-items: center; padding: .35rem .7rem; border-radius: 5px; font-size: .8rem; border: 1px solid; white-space: nowrap; line-height: 1.4; }
.btn-add     { background: transparent; border-color: #cbd5e1; color: var(--primary); font-size: .8rem; }
.btn-add:hover { background: var(--primary-tint-light); border-color: var(--primary-tint-mid); }
.btn-save    { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-save:hover { background: var(--secondary); border-color: var(--secondary); }
.btn-cancel  { background: #fff; color: #475569; border-color: #cbd5e1; }
.btn-cancel:hover { background: #f8fafc; }
.btn-edit    { background: #fff; color: #475569; border-color: #cbd5e1; font-size: .78rem; }
.btn-edit:hover { background: #f1f5f9; }
.btn-delete  { background: transparent; color: #dc2626; border-color: transparent; font-size: .78rem; padding: .35rem .4rem; }
.btn-delete:hover { background: #fef2f2; border-color: #fca5a5; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--secondary); border-color: var(--secondary); }
.btn-link    { background: transparent; color: var(--secondary); border-color: transparent; padding-left: 0; }
.btn-link:hover { text-decoration: underline; }
.btn-full    { width: 100%; padding: .6rem; background: var(--primary); color: #fff; border: none; border-radius: 6px; font-size: .9rem; font-weight: 600; cursor: pointer; transition: background .12s; }
.btn-full:hover { background: var(--secondary); }
.btn-complete { background: var(--primary); color: #fff; border-color: var(--primary); padding: .5rem 1rem; font-size: .875rem; }
.btn-complete:hover { background: var(--secondary); border-color: var(--secondary); }
.btn-danger  { background: transparent; color: #dc2626; border: 1px solid #fca5a5; border-radius: 5px; padding: .35rem .75rem; font-size: .8rem; font-weight: 500; cursor: pointer; transition: background .12s, border-color .12s; white-space: nowrap; line-height: 1.4; }
.btn-danger:hover { background: #fef2f2; border-color: #dc2626; }
.btn-purge-day { background: transparent; border: none; color: #fca5a5; font-size: .72rem; cursor: pointer; padding: .15rem .4rem; border-radius: 3px; transition: color .12s, background .12s; line-height: 1.4; }
.btn-purge-day:hover { color: #dc2626; background: #fef2f2; }
.btn-download { background: var(--primary); color: #fff; border: none; border-radius: 5px; padding: .5rem 1.1rem; font-size: .875rem; font-weight: 600; cursor: pointer; transition: background .12s; }
.btn-download:hover { background: var(--secondary); }
.btn-download-plain { background: #fff; color: #475569; border: 1px solid #cbd5e1; border-radius: 5px; padding: .5rem 1.1rem; font-size: .875rem; font-weight: 500; cursor: pointer; transition: background .12s; }
.btn-download-plain:hover { background: #f8fafc; }

/* ---- Badges & labels ---- */
.billable-badge { display: inline-block; background: #dcfce7; color: #15803d; font-size: .72rem; font-weight: 600; padding: .1rem .45rem; border-radius: 10px; }
.customer-cell  { color: var(--secondary); font-size: .82rem; font-weight: 500; }
.customer-none  { color: #cbd5e1; font-size: .82rem; }
.internal-badge { display: inline-block; background: #f1f5f9; color: #64748b; font-size: .72rem; font-weight: 600; padding: .1rem .45rem; border-radius: 10px; margin-left: .35rem; vertical-align: middle; }
.internal-label { display: inline-flex; align-items: center; gap: .3rem; font-size: .875rem; color: #475569; white-space: nowrap; cursor: pointer; }
.completed-chip { display: inline-flex; align-items: center; background: #dcfce7; color: #15803d; font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 10px; }
.meta           { color: #64748b; font-size: .82rem; }
.billable-total { color: #15803d; font-weight: 500; }

/* ---- Day cards ---- */
.day-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: .75rem; overflow: hidden; }
.day-card.today { border-color: var(--primary-tint-mid); }
.day-card.today .day-header { background: var(--primary-tint-light); }
.day-header { display: flex; align-items: center; justify-content: space-between; padding: .6rem 1rem; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.day-header-right { display: flex; align-items: center; gap: .5rem; }
.day-name { font-weight: 600; font-size: .9rem; color: #334155; }
.day-card.today .day-name { color: var(--secondary); }
.day-total         { font-size: .8rem; font-weight: 600; color: #475569; background: #e2e8f0; padding: .15rem .5rem; border-radius: 12px; }
.day-total-ok      { background: #dcfce7; color: #15803d; font-size: .8rem; font-weight: 600; padding: .15rem .5rem; border-radius: 12px; }
.day-total-low     { background: #fee2e2; color: #b91c1c; font-size: .8rem; font-weight: 600; padding: .15rem .5rem; border-radius: 12px; }
.day-total-neutral { background: #e2e8f0; color: #475569;  font-size: .8rem; font-weight: 600; padding: .15rem .5rem; border-radius: 12px; }

/* ---- Week view ---- */
.week-nav   { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.week-label { flex: 1; text-align: center; font-size: 1rem; font-weight: 600; color: #334155; }
.edit-row td { padding: .6rem .75rem; background: #fffbeb; }
.edit-form-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.add-form { padding: .6rem .75rem; background: #f8fafc; border-top: 1px solid #e2e8f0; }
.add-form-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.add-entry-row { padding: .5rem .75rem; }
.week-locked-banner { background: #f0fdf4; border: 1px solid #86efac; color: #15803d; padding: .6rem 1rem; border-radius: 6px; margin-bottom: 1.25rem; font-size: .875rem; }
.complete-bar { margin-top: .75rem; display: flex; justify-content: flex-end; }
.week-summary { margin-top: 1rem; padding: .8rem 1rem; background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; display: flex; gap: 1.5rem; font-size: .9rem; color: #334155; }
.week-summary strong { font-weight: 600; }

/* ---- Quick registration ---- */
.date-heading { font-size: 1.05rem; font-weight: 600; color: #334155; margin-bottom: 1rem; }
.quick-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 1.25rem 1rem; }
.quick-form-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.entries-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; margin-top: 1.25rem; overflow: hidden; }
.entries-header { display: flex; align-items: center; justify-content: space-between; padding: .6rem 1rem; background: #f8fafc; border-bottom: 1px solid #e2e8f0; font-size: .85rem; font-weight: 600; color: #334155; }
.week-link { display: inline-block; margin-top: 1rem; font-size: .85rem; color: var(--primary); text-decoration: none; }
.week-link:hover { text-decoration: underline; }

/* ---- Login / setup ---- */
.login-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 2.5rem 2rem; width: 100%; max-width: 380px; box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.login-card .logo { font-size: 1.4rem; letter-spacing: -.5px; margin-bottom: 1.8rem; display: block; text-align: center; color: var(--primary); }
.login-card label { display: block; font-size: .8rem; font-weight: 600; color: #475569; margin-bottom: .35rem; text-transform: uppercase; letter-spacing: .04em; }
.login-card input[type=text],
.login-card input[type=password] { width: 100%; padding: .6rem .8rem; border: 1px solid #cbd5e1; border-radius: 6px; font-size: .95rem; color: #1e293b; margin-bottom: 1.1rem; transition: border-color .15s; }
.login-card input:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 3px var(--focus-ring); }
.btn-login { width: 100%; padding: .7rem; background: var(--primary); color: #fff; border: none; border-radius: 6px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: background .15s; }
.btn-login:hover { background: var(--secondary); }

/* ---- Admin: gate ---- */
.gate-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.gate-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 2.5rem 2rem; width: 100%; max-width: 360px; box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.gate-card h1 { font-size: 1.2rem; margin-bottom: 1.5rem; }
.gate-label { display: block; font-size: .78rem; font-weight: 600; color: #475569; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .35rem; }
.gate-input { width: 100%; padding: .6rem .8rem; border: 1px solid #cbd5e1; border-radius: 6px; font-size: .95rem; margin-bottom: 1rem; }
.gate-input:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 2px var(--focus-ring); }
.msg-error { background: #fef2f2; border: 1px solid #fca5a5; color: #b91c1c; padding: .6rem .8rem; border-radius: 6px; font-size: .875rem; margin-bottom: 1rem; }
.back { display: block; text-align: center; margin-top: 1rem; font-size: .85rem; color: var(--primary); text-decoration: none; }
.back:hover { text-decoration: underline; }

/* ---- Admin: tabs ---- */
.tabs { display: flex; border-bottom: 2px solid #e2e8f0; margin-bottom: 1.5rem; }
.tab { padding: .6rem 1.2rem; font-size: .9rem; font-weight: 500; color: #64748b; text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .12s; }
.tab:hover { color: #1e293b; }
.tab.active { color: var(--secondary); border-bottom-color: var(--secondary); font-weight: 600; }

/* ---- Admin: inline add row ---- */
.add-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.add-row input[type=text] { flex: 1; min-width: 200px; padding: .5rem .7rem; border: 1px solid #cbd5e1; border-radius: 6px; font-size: .9rem; }
.add-row input:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 2px var(--focus-ring); }

/* ---- Admin: user form ---- */
.user-form label { display: block; font-size: .78rem; font-weight: 600; color: #475569; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .3rem; }
.user-form input[type=text],
.user-form input[type=password] { width: 100%; padding: .55rem .75rem; border: 1px solid #cbd5e1; border-radius: 6px; font-size: .9rem; margin-bottom: .9rem; }
.user-form input:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 2px var(--focus-ring); }

/* ---- Admin: breadcrumb ---- */
.breadcrumb { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: #64748b; margin-bottom: 1.25rem; }
.breadcrumb a { color: var(--secondary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: #cbd5e1; }
.sheet-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.sheet-summary { margin-top: 1rem; padding: .8rem 1rem; background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; display: flex; gap: 1.5rem; font-size: .9rem; color: #334155; }
.sheet-summary strong { font-weight: 600; }

/* ---- Admin: reports ---- */
.sub-tabs { display: flex; gap: .35rem; margin-bottom: 1.25rem; }
.sub-tab { padding: .35rem .9rem; font-size: .85rem; font-weight: 500; color: #64748b; text-decoration: none; border: 1px solid #e2e8f0; border-radius: 5px; background: #fff; transition: background .12s, color .12s; }
.sub-tab:hover { background: #f8fafc; color: #334155; }
.sub-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.report-nav { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
.report-nav-label { flex: 1; text-align: center; font-weight: 600; font-size: 1rem; color: #334155; }

/* ---- Admin: pivot table ---- */
.pivot-wrap { overflow-x: auto; margin-bottom: 1.25rem; }
.pivot-table { border-collapse: collapse; font-size: .8rem; white-space: nowrap; width: 100%; }
.pivot-table th { padding: .4rem .6rem; background: #f8fafc; border: 1px solid #e2e8f0; text-align: center; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: #64748b; font-weight: 600; }
.pivot-table th.th-left { text-align: left; min-width: 170px; }
.pivot-table td { padding: .35rem .6rem; border: 1px solid #f1f5f9; vertical-align: top; }
.pivot-table tbody tr:hover td { background: #fafafa; }
.pivot-table tfoot td { padding: .4rem .6rem; border: 1px solid #e2e8f0; background: #f8fafc; font-weight: 600; }
.pcell { text-align: right; min-width: 58px; }
.pcell-total  { display: block; font-variant-numeric: tabular-nums; }
.pcell-bill   { display: block; font-size: .7rem; color: #15803d; font-variant-numeric: tabular-nums; }
.pcell-empty  { color: #d1d5db; }
.pcell-strong { background: #f8fafc; }

/* ---- Admin: export ---- */
.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .75rem 1rem; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.filter-bar select { padding: .35rem .6rem; border: 1px solid #cbd5e1; border-radius: 5px; font-size: .85rem; color: #1e293b; background: #fff; }
.filter-bar label { font-size: .8rem; font-weight: 600; color: #475569; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.filter-group { display: flex; align-items: center; gap: .3rem; }
.exp-badge-yes { display: inline-block; background: #dcfce7; color: #15803d; font-size: .7rem; font-weight: 600; padding: .1rem .4rem; border-radius: 10px; white-space: nowrap; }
.exp-badge-no  { display: inline-block; background: #f1f5f9; color: #94a3b8; font-size: .7rem; font-weight: 600; padding: .1rem .4rem; border-radius: 10px; }
.download-bar  { display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem; background: #f8fafc; border-top: 1px solid #e2e8f0; flex-wrap: wrap; }

/* ---- Import ---- */
.format-table { width: 100%; border-collapse: collapse; font-size: .85rem; margin: .75rem 0; }
.format-table th { text-align: left; padding: .4rem .6rem; background: #f8fafc; border: 1px solid #e2e8f0; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: #64748b; }
.format-table td { padding: .4rem .6rem; border: 1px solid #f1f5f9; vertical-align: top; }
.format-table tbody tr:nth-child(even) td { background: #fafafa; }
code { font-family: ui-monospace, monospace; font-size: .82rem; background: #f1f5f9; padding: .1rem .3rem; border-radius: 3px; }
.example-row { font-family: ui-monospace, monospace; font-size: .82rem; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 5px; padding: .5rem .75rem; margin-top: .5rem; color: #334155; word-break: break-all; }
.import-ok td  { background: #f0fdf4 !important; }
.import-err td { background: #fef2f2 !important; }
.reason-cell   { color: #b91c1c; font-size: .8rem; }
.raw-cell      { font-family: ui-monospace, monospace; font-size: .75rem; color: #64748b; }
.for-user-banner { display: flex; align-items: center; gap: .6rem; background: var(--primary-tint-light); border: 1px solid var(--primary-tint-mid); border-radius: 6px; padding: .6rem 1rem; margin-bottom: 1.25rem; font-size: .875rem; }
.for-user-banner strong { color: var(--primary); }
.field-label   { display: block; font-size: .78rem; font-weight: 600; color: #475569; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .35rem; }
.check-label   { display: flex; align-items: center; gap: .4rem; font-size: .875rem; color: #475569; margin-bottom: 1rem; cursor: pointer; }

/* ---- Copy button ---- */
.desc-cell { display: flex; align-items: center; gap: .4rem; }
.btn-copy  { flex-shrink: 0; background: none; border: none; cursor: pointer; padding: .1rem; color: #94a3b8; line-height: 0; border-radius: 3px; transition: color .12s; }
.btn-copy:hover  { color: var(--primary); }
.btn-copy.copied { color: #16a34a; }
