:root {
  --orange: #DC8914;
  --orange-tint: #FCF3E3;
  --black: #000000;
  --ink: #1A1A1A;
  --muted: #6B6B6B;
  --line: #E4E4E4;
  --bg: #F5F5F4;
  --card: #FFFFFF;
  --green: #1E7A46; --green-bg: #E6F4EC;
  --red: #B42318;   --red-bg: #FDECEA;
  --blue: #1D4E89;  --blue-bg: #E8F0FA;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--black); text-decoration: underline; text-decoration-color: var(--orange); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { background: var(--orange-tint); }
h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---- top bar ---- */
.topbar { background: var(--black); border-bottom: 4px solid var(--orange); }
.bar { display: flex; align-items: center; gap: 24px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand img { height: 36px; display: block; }
.topbar nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.topbar nav a { color: #E8E8E8; text-decoration: none; padding: 8px 12px; border-radius: 6px; font-weight: 600; font-size: 14px; }
.topbar nav a:hover { background: #262626; color: #fff; }
.topbar nav a.on { background: var(--orange); color: var(--black); }
.who { display: flex; align-items: center; gap: 10px; color: #CFCFCF; font-size: 13px; }
.who a { color: #fff; }
.who button { background: none; border: 1px solid #555; color: #fff; border-radius: 6px; padding: 5px 10px; cursor: pointer; font: inherit; font-size: 13px; }
.who button:hover { border-color: var(--orange); color: var(--orange); }
.tag-role { background: #262626; color: var(--orange); border-radius: 4px; padding: 1px 7px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; }

main { padding: 26px 0 60px; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.pagehead p { margin: 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---- cards / grid ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card > h2:first-child, .card .cardhead { margin-top: 0; }
.cardhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.cardhead h2 { margin: 0; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .g4, .g3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .g4, .g3, .g2 { grid-template-columns: 1fr; } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; border-top: 3px solid var(--black); }
.stat.hl { border-top-color: var(--orange); }
.stat.bad { border-top-color: var(--red); }
.stat .l { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.stat .v { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12.5px; color: var(--muted); }

/* ---- tables ---- */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #FAFAF9; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #FCFCFB; }
td.r, th.r { text-align: right; }
tfoot td { font-weight: 700; background: #FAFAF9; }

/* ---- forms ---- */
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #C9C9C9; border-radius: 7px; font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(220,137,20,.45); outline-offset: 1px; border-color: var(--orange); }
.field { margin-bottom: 14px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.inline { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline .field { margin-bottom: 0; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; }
.check input { margin-top: 4px; accent-color: var(--orange); }

.btn { display: inline-block; border: 1px solid var(--black); background: var(--black); color: #fff; border-radius: 7px; padding: 8px 14px; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; line-height: 1.3; }
.btn:hover { background: #2a2a2a; }
.btn.primary { background: var(--orange); border-color: var(--orange); color: var(--black); }
.btn.primary:hover { background: #E89A2B; border-color: #E89A2B; }
.btn.ghost { background: #fff; color: var(--ink); border-color: #BDBDBD; }
.btn.ghost:hover { border-color: var(--black); background: #fff; }
.btn.danger { background: #fff; color: var(--red); border-color: #E3A39C; }
.btn.danger:hover { background: var(--red-bg); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--black); text-decoration: underline; text-decoration-color: var(--orange); text-decoration-thickness: 2px; text-underline-offset: 3px; cursor: pointer; font: inherit; }

/* ---- badges / flash ---- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; background: #EEE; color: #444; }
.badge.ok, .badge.approved, .badge.paid { background: var(--green-bg); color: var(--green); }
.badge.submitted, .badge.pending { background: var(--blue-bg); color: var(--blue); }
.badge.sent, .badge.warn, .badge.returned, .badge.low { background: var(--orange-tint); color: var(--black); box-shadow: inset 0 0 0 1px var(--orange); }
.badge.bad, .badge.over, .badge.overdue { background: var(--red-bg); color: var(--red); }
.badge.draft, .badge.none, .badge.closed { background: #EEE; color: #555; }
.badge.ot { background: var(--orange); color: var(--black); }
.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; word-break: break-word; }
.flash.ok { background: var(--green-bg); border-color: #B5DDC5; color: #14532D; }
.flash.err { background: var(--red-bg); border-color: #F0B8B2; color: #7A1A12; }
.callout { background: var(--orange-tint); border: 1px solid #F0D3A0; border-radius: 8px; padding: 11px 14px; margin-bottom: 16px; }
.errors { background: var(--red-bg); border: 1px solid #F0B8B2; color: #7A1A12; border-radius: 8px; padding: 10px 14px 10px 30px; margin-bottom: 16px; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* ---- progress bar ---- */
.bar-track { background: #ECECEA; border-radius: 99px; height: 9px; overflow: hidden; min-width: 90px; }
.bar-fill { background: var(--orange); height: 100%; border-radius: 99px; }
.bar-fill.low { background: repeating-linear-gradient(135deg, var(--orange) 0 7px, var(--black) 7px 10px); }
.bar-fill.over { background: var(--red); }
.bar-fill.inv { background: var(--black); }

/* ---- timesheet grid ---- */
.weeknav { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.weeknav h1 { margin: 0 6px; font-size: 22px; }
.ts { min-width: 1240px; }
.ts th, .ts td { text-align: center; padding: 8px 6px; }
.ts th:first-child, .ts td:first-child { text-align: left; padding-left: 14px; min-width: 200px; }
.ts th .d { display: block; font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.ts th.we, .ts td.we { background: #EFEFED; }
.ts input[type=number] { width: 68px; text-align: center; padding: 8px 4px; -moz-appearance: textfield; }
.ts input[type=number]::-webkit-outer-spin-button, .ts input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ts input:disabled { background: #E3E3E1; border-color: #D4D4D2; color: #9A9A98; cursor: not-allowed; }
.ts .ro { font-weight: 600; font-variant-numeric: tabular-nums; }
.ts tfoot td { font-variant-numeric: tabular-nums; }
.ts .tot { font-weight: 800; }
.ts .over { background: var(--orange-tint); color: var(--black); font-weight: 800; box-shadow: inset 0 -3px 0 var(--orange); }
.proj-name { font-weight: 700; display: block; }
.proj-client { font-size: 12.5px; color: var(--muted); }

/* ---- auth pages ---- */
body.auth { background: var(--black); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.authbox { width: 100%; max-width: 400px; }
.authbox .logo { text-align: center; margin-bottom: 22px; }
.authbox .logo img { height: 44px; }
.authcard { background: #fff; border-radius: 12px; padding: 28px; border-top: 5px solid var(--orange); }
.authcard h1 { font-size: 22px; margin-bottom: 14px; }
.authcard .btn { width: 100%; padding: 11px; }
.authfoot { text-align: center; margin-top: 14px; font-size: 13px; }
.authfoot a { color: #ddd; }

@media (max-width: 700px) {
  th, td { padding: 9px 10px; }
  h1 { font-size: 22px; }
}
@media print { .topbar, .actions, .btn { display: none !important; } body { background: #fff; } }

/* ---- days grid, bank holidays, work log ---- */
.ts select { width: 100%; min-width: 150px; padding: 8px 4px; }
.ts select:disabled { background: #E3E3E1; border-color: #D4D4D2; color: #9A9A98; cursor: not-allowed; }
.ts th.bh, .ts td.bh { background: #E6E6E3; }
.ts .bhname { color: var(--black); font-weight: 700; }
.ts td.over { color: var(--red); font-weight: 800; }
.actblock { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: #FCFCFB; }
.actblock[hidden] { display: none; }
.acthead { margin-bottom: 6px; }
.actline { display: grid; grid-template-columns: 1fr 90px; gap: 8px; margin-bottom: 6px; }
.actline.ro { grid-template-columns: 1fr auto; padding: 3px 0; border-bottom: 1px dashed var(--line); }
.actline input { padding: 7px 9px; }
@media (max-width: 600px) { .actline { grid-template-columns: 1fr 70px; } }
.stat.warn { border-top-color: var(--orange); }
.statuslist { list-style: none; margin: 0; padding: 0; }
.statuslist li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.statuslist li:last-child { border-bottom: 0; }
.ssobtn { display: block; text-align: center; margin-bottom: 14px; }
.or { text-align: center; color: var(--muted); font-size: 12px; margin: 14px 0; text-transform: uppercase; letter-spacing: .08em; }

/* ---- nav dropdowns ---- */
.topbar nav { align-items: center; flex-wrap: nowrap; }
details.dd { position: relative; }
details.dd > summary { list-style: none; cursor: pointer; color: #E8E8E8; padding: 8px 12px; border-radius: 6px; font-weight: 600; font-size: 14px; user-select: none; }
details.dd > summary::-webkit-details-marker { display: none; }
details.dd > summary::after { content: ""; display: inline-block; margin-left: 7px; border: 4px solid transparent; border-top-color: currentColor; border-bottom: 0; vertical-align: middle; }
details.dd > summary:hover, details.dd[open] > summary { background: #262626; color: #fff; }
details.dd > summary.on { background: var(--orange); color: var(--black); }
.ddmenu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 190px; background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--orange); border-radius: 8px; box-shadow: 0 10px 28px rgba(0,0,0,.25); padding: 6px; z-index: 50; }
.topbar nav .ddmenu a { display: block; color: var(--ink); padding: 8px 12px; border-radius: 6px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.topbar nav .ddmenu a:hover { background: var(--orange-tint); color: var(--black); }
@media (max-width: 760px) { .topbar nav { flex-wrap: wrap; } }
.ts .customh { width: 100%; margin-top: 4px; padding: 6px; text-align: center; }
.ts .customh[hidden] { display: none; }
.acttotal.ok { color: var(--green); font-weight: 600; }
.acttotal.bad { color: var(--red); font-weight: 600; }
[hidden]{display:none!important}

.badge.expired { background: var(--red-bg); color: var(--red); }
@media print { .topbar, .actions, .btn, form { display: none !important; } .card { break-inside: avoid; } details { display: none; } }

.btn, .topbar a, .brand, .ddmenu a, a.btn { text-decoration: none; }
.btn:hover, .topbar a:hover, .ddmenu a:hover { background-clip: border-box; }
a.btn:hover { background: #2a2a2a; }
a.btn.primary:hover { background: #E89A2B; }
a.btn.ghost:hover { background: #fff; }
.topbar nav a:hover { background: #262626; }
.topbar nav a.on:hover { background: var(--orange); }
.who a { text-decoration: underline; text-decoration-color: var(--orange); }
.who a:hover { background: transparent; }
.authfoot a { text-decoration-color: var(--orange); }
.authfoot a:hover { background: transparent; }
