:root {
  color-scheme: light;
  --ink: #12211c;
  --muted: #6b7772;
  --line: #dfe6e2;
  --surface: #ffffff;
  --canvas: #f4f7f5;
  --nav: #10241d;
  --nav-soft: #1b352c;
  --brand: #168a63;
  --brand-dark: #0c6548;
  --brand-pale: #dff5eb;
  --danger: #c13f45;
  --warning: #d88b22;
  --shadow: 0 18px 45px rgba(21, 43, 34, 0.08);
  font-family: "Plus Jakarta Sans", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .56; }
a { color: inherit; }
.hidden { display: none !important; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, .92fr) minmax(430px, 1.08fr);
}
.auth-brand-panel {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  padding: clamp(32px, 5vw, 72px);
  color: #fff;
  background:
    radial-gradient(circle at 78% 20%, rgba(99, 224, 174, .17), transparent 27%),
    radial-gradient(circle at 4% 78%, rgba(72, 165, 131, .2), transparent 34%),
    linear-gradient(145deg, #0b2119 0%, #132d24 62%, #0a1b15 100%);
}
.auth-brand-panel::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  right: -210px;
  bottom: -180px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
  box-shadow: 0 0 0 60px rgba(255,255,255,.025), 0 0 0 120px rgba(255,255,255,.018);
}
.brand-lockup { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 35px; height: 35px; color: #63e0ae; border: 1px solid currentColor; border-radius: 11px; }
.auth-hero { position: relative; z-index: 1; max-width: 590px; padding: 60px 0; }
.eyebrow { display: block; color: var(--brand); font-size: 11px; line-height: 1.3; font-weight: 800; letter-spacing: .15em; }
.auth-brand-panel .eyebrow { color: #63e0ae; }
.auth-hero h1 { margin: 18px 0 22px; font-size: clamp(48px, 6vw, 84px); line-height: .99; letter-spacing: -.065em; }
.auth-hero h1 em { color: #63e0ae; font-style: normal; }
.auth-hero p { max-width: 540px; margin: 0; color: #bfcec8; font-size: clamp(16px, 1.4vw, 20px); line-height: 1.7; }
.feature-pills { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 34px; }
.feature-pills span { padding: 10px 14px; color: #d9e7e1; font-size: 12px; font-weight: 700; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; background: rgba(255,255,255,.04); }
.auth-brand-panel > small { color: #7e948b; }
.auth-form-panel { display: grid; place-items: center; min-height: 100vh; padding: 44px 24px; background: #f8faf9; }
.auth-card { width: min(100%, 430px); display: grid; gap: 20px; }
.auth-card h2 { margin: 0 0 8px; font-size: 38px; letter-spacing: -.04em; }
.auth-card p { margin: 0; color: var(--muted); line-height: 1.55; }
.mobile-brand { display: none; margin-bottom: 32px; color: var(--brand-dark); font-weight: 800; }

label { display: grid; gap: 8px; color: #405049; font-size: 12px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  color: var(--ink);
  border: 1px solid #d8e0dc;
  border-radius: 10px;
  outline: none;
  background: #fff;
  transition: border-color .18s, box-shadow .18s;
}
input, select { height: 46px; padding: 0 13px; }
textarea { min-height: 82px; padding: 12px 13px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(22,138,99,.12); }
label small { color: #8b9691; font-weight: 500; }
#registerSetupCode { text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }

.btn {
  min-height: 42px;
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 800;
  transition: transform .15s, filter .15s, box-shadow .15s;
}
.btn:hover:not(:disabled) { filter: brightness(.97); transform: translateY(-1px); }
.btn.primary { color: #fff; background: var(--brand); box-shadow: 0 9px 22px rgba(22,138,99,.17); }
.btn.secondary { color: #354840; border-color: #d9e1dd; background: #fff; }
.btn.success { color: #fff; background: var(--brand); }
.btn.warning { color: #fff; background: var(--warning); }
.btn.danger { color: #fff; background: var(--danger); }
.btn.wide { width: 100%; }
.text-button { padding: 0; color: var(--brand-dark); border: 0; font-weight: 800; background: none; }
.form-switch { text-align: center; font-size: 13px; }
.icon-button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; color: inherit; border: 0; border-radius: 9px; background: transparent; }
.icon-button:hover { background: rgba(127,147,139,.13); }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: 244px;
  display: flex;
  flex-direction: column;
  padding: 29px 20px 20px;
  color: #dce7e3;
  background: var(--nav);
}
.sidebar .brand-lockup { padding: 0 8px 38px; color: #fff; }
.main-nav { display: grid; gap: 7px; }
.nav-item { display: flex; align-items: center; gap: 13px; width: 100%; padding: 12px 14px; color: #97aaa2; border: 0; border-radius: 9px; text-align: left; font-size: 13px; font-weight: 700; background: transparent; }
.nav-item span { width: 17px; color: #7f988e; font-size: 17px; }
.nav-item:hover, .nav-item.active { color: #fff; background: var(--nav-soft); }
.nav-item.active span { color: #63e0ae; }
.sidebar-timer { display: grid; gap: 9px; margin-top: auto; padding: 18px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: rgba(255,255,255,.035); }
.timer-state { display: flex; align-items: center; gap: 8px; color: #9fb0a9; font-size: 11px; font-weight: 700; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #778981; }
.status-dot.working { background: #4ee0a7; box-shadow: 0 0 0 5px rgba(78,224,167,.11); }
.status-dot.break { background: #ffb951; box-shadow: 0 0 0 5px rgba(255,185,81,.11); }
.sidebar-timer strong { color: #fff; font-size: 25px; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.sidebar-timer > span:last-child { overflow: hidden; color: #84988f; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.user-panel { display: grid; grid-template-columns: 36px 1fr 36px; align-items: center; gap: 10px; margin-top: 15px; padding: 13px 6px 0; border-top: 1px solid rgba(255,255,255,.08); }
.user-panel > div { display: grid; min-width: 0; }
.user-panel strong, .user-panel small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-panel strong { color: #fff; font-size: 12px; }
.user-panel small { color: #748b81; font-size: 9px; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; color: #0e4c38; border-radius: 10px; font-weight: 800; background: #92e7c3; }
.mobile-header, .mobile-nav { display: none; }

.main-content { min-height: 100vh; margin-left: 244px; padding: 0 clamp(20px, 3.3vw, 52px) 56px; }
.topbar { min-height: 104px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 0 0 4px; font-size: 25px; letter-spacing: -.035em; }
.topbar p { margin: 0; color: var(--muted); font-size: 11px; }
.quick-timer { display: flex; align-items: center; gap: 15px; }
.quick-timer span { color: var(--muted); font-size: 11px; font-weight: 600; }
.view { display: none; padding-top: 29px; }
.view.active { display: block; }
.card { border: 1px solid #e2e8e5; border-radius: 13px; background: var(--surface); box-shadow: 0 2px 2px rgba(22,40,33,.015); }

.filter-bar { display: flex; align-items: end; flex-wrap: wrap; gap: 14px; padding: 15px 17px; }
.filter-bar label { min-width: 175px; }
.filter-bar select, .filter-bar input { height: 39px; }
.custom-range { display: flex; gap: 10px; }
.custom-range label { min-width: 142px; }
.filter-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.upload-label { display: inline-grid; place-items: center; cursor: pointer; }
.upload-label input { display: none; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin: 15px 0; }
.kpi { min-height: 137px; display: flex; flex-direction: column; justify-content: center; padding: 21px; }
.kpi > span { color: var(--muted); font-size: 11px; font-weight: 700; }
.kpi strong { margin: 10px 0 5px; overflow: hidden; font-size: clamp(23px, 2.5vw, 31px); letter-spacing: -.045em; text-overflow: ellipsis; white-space: nowrap; }
.kpi small { color: #91a09a; font-size: 10px; }
.chart-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 15px; }
.chart-card { padding: 21px; }
.chart-card h2, .form-card h2 { margin: 0 0 18px; font-size: 14px; letter-spacing: -.015em; }
.chart-wrap { position: relative; height: 250px; }
.recent-card { margin-top: 15px; padding: 21px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.section-heading h2 { margin: 4px 0 0; font-size: 15px; }
.section-heading > span { color: var(--muted); font-size: 11px; }
.recent-row { display: grid; grid-template-columns: minmax(130px, 1.2fr) minmax(160px, 2fr) auto; align-items: center; gap: 14px; padding: 15px 0; border-bottom: 1px solid #edf1ef; }
.recent-row:last-child { border-bottom: 0; }
.project-label { display: flex; align-items: center; gap: 9px; min-width: 0; font-size: 12px; font-weight: 800; }
.project-label .project-dot { flex: 0 0 auto; }
.project-dot { width: 9px; height: 9px; border-radius: 50%; background: #9ca8a3; }
.recent-row p { margin: 0; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.recent-row time { font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.empty-state { padding: 50px 20px; text-align: center; }
.empty-state strong { display: block; margin-bottom: 7px; font-size: 15px; }
.empty-state p { margin: 0 0 18px; color: var(--muted); font-size: 12px; }

.tracker-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(330px, .75fr); gap: 17px; }
.live-card, .form-card { padding: clamp(22px, 3vw, 35px); }
.live-card { min-height: 525px; display: flex; flex-direction: column; }
.live-clock { display: grid; justify-items: center; padding: 38px 15px; }
.live-clock strong { margin: 12px 0; font-size: clamp(48px, 6vw, 74px); font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: -.06em; }
.live-clock > span:last-child { color: var(--muted); font-size: 11px; }
.timer-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 9px; margin-bottom: 30px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.active-timeline { display: grid; gap: 8px; margin-top: 25px; color: var(--muted); font-size: 11px; }
.timeline-row { display: flex; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); }
.project-layout { display: grid; grid-template-columns: minmax(285px, .62fr) minmax(0, 1.38fr); gap: 25px; align-items: start; }
.project-layout form { display: grid; gap: 19px; }
.color-picker { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; border: 0; }
.color-picker legend { width: 100%; margin-bottom: 3px; color: #405049; font-size: 12px; font-weight: 700; }
.color-picker label { display: block; cursor: pointer; }
.color-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.color-dot { display: block; width: 27px; height: 27px; border: 4px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #d7dfdb; }
.color-picker input:checked + .color-dot { box-shadow: 0 0 0 2px var(--ink); }
.emerald { background: #10b981; } .blue { background: #3b82f6; } .violet { background: #8b5cf6; }
.pink { background: #ec4899; } .amber { background: #f59e0b; } .red { background: #ef4444; } .cyan { background: #06b6d4; }
.projects-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; margin-top: 16px; }
.project-card { position: relative; min-height: 138px; padding: 21px; overflow: hidden; }
.project-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--project-color); }
.project-card-head { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.project-card h3 { margin: 0; font-size: 15px; }
.project-card p { margin: 12px 0 0; color: var(--muted); font-size: 11px; }
.project-actions { display: flex; gap: 3px; }
.project-actions button { width: 31px; height: 31px; color: var(--muted); border: 0; border-radius: 7px; background: transparent; }
.project-actions button:hover { color: var(--ink); background: var(--canvas); }

.table-card { margin-top: 15px; padding: 21px; }
.table-scroll { overflow-x: auto; margin: 12px -4px -3px; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th { padding: 12px 10px; color: #88958f; text-align: left; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; border-bottom: 1px solid var(--line); }
td { padding: 14px 10px; border-bottom: 1px solid #edf1ef; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
.entry-notes { max-width: 270px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.time-cell, .duration-cell { font-variant-numeric: tabular-nums; white-space: nowrap; }
.duration-cell { font-weight: 800; }
.row-actions { display: flex; gap: 4px; }
.row-actions button { padding: 6px 8px; color: var(--muted); border: 0; border-radius: 6px; background: transparent; }
.row-actions button:hover { color: var(--ink); background: var(--canvas); }
.mobile-entry-list { display: none; }

dialog { width: min(92vw, 600px); max-height: 90vh; padding: 0; overflow: auto; border: 0; border-radius: 15px; color: var(--ink); box-shadow: 0 30px 90px rgba(7,24,17,.28); }
dialog::backdrop { background: rgba(5,21,15,.62); backdrop-filter: blur(3px); }
.dialog-card { display: grid; gap: 21px; padding: 27px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; }
.radio-line { grid-template-columns: 20px 1fr; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.radio-line input { width: 16px; height: 16px; margin: 2px 0 0; }
.radio-line span { display: grid; gap: 3px; }
.radio-line small { color: var(--muted); font-weight: 500; line-height: 1.45; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: min(430px, calc(100vw - 48px)); padding: 13px 16px; color: #fff; border-radius: 9px; background: #18352b; box-shadow: var(--shadow); opacity: 0; transform: translateY(15px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #9f353b; }

@media (max-width: 1120px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tracker-layout { grid-template-columns: 1fr; }
  .live-card { min-height: 460px; }
}

@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand-panel { display: none; }
  .mobile-brand { display: block; }
  .sidebar { inset: 63px auto 0 -260px; transition: left .2s; box-shadow: 20px 0 45px rgba(9,28,21,.18); }
  .sidebar.open { left: 0; }
  .mobile-header { position: sticky; top: 0; z-index: 40; height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; color: #fff; background: var(--nav); }
  .mobile-header .brand-lockup { font-size: 16px; }
  .mobile-header .brand-mark { width: 29px; height: 29px; }
  .main-content { margin-left: 0; padding: 0 20px 86px; }
  .topbar { min-height: 88px; }
  .mobile-nav { position: fixed; inset: auto 0 0 0; z-index: 35; height: 65px; display: grid; grid-template-columns: repeat(4, 1fr); padding: 7px max(8px, env(safe-area-inset-right)) max(7px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(10px); }
  .mobile-nav button { color: var(--muted); border: 0; border-radius: 8px; font-size: 10px; font-weight: 700; background: transparent; }
  .mobile-nav button.active { color: var(--brand-dark); background: var(--brand-pale); }
  .project-layout { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .auth-form-panel { padding: 35px 20px; }
  .auth-card h2 { font-size: 32px; }
  .main-content { padding-inline: 14px; }
  .topbar { align-items: flex-start; min-height: 108px; padding: 19px 2px; }
  .quick-timer { align-items: flex-end; flex-direction: column; gap: 7px; }
  .quick-timer span { display: none; }
  .filter-bar { align-items: stretch; }
  .filter-bar label, .custom-range label { min-width: 0; flex: 1; }
  .filter-bar > label { width: calc(50% - 8px); }
  .custom-range { width: 100%; }
  .filter-actions { width: 100%; margin-left: 0; }
  .filter-actions .btn { flex: 1; }
  .kpi-grid, .chart-grid, .projects-grid { grid-template-columns: 1fr; }
  .kpi { min-height: 115px; }
  .chart-wrap { height: 230px; }
  .recent-row { grid-template-columns: 1fr auto; }
  .recent-row p { grid-column: 1 / -1; grid-row: 2; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .live-card, .form-card { padding: 21px; }
  .live-clock { padding-inline: 0; }
  .table-scroll { display: none; }
  .mobile-entry-list { display: grid; gap: 10px; margin-top: 16px; }
  .mobile-entry-card { display: grid; gap: 11px; padding: 15px; border: 1px solid var(--line); border-radius: 10px; }
  .mobile-entry-head, .mobile-entry-meta { display: flex; justify-content: space-between; gap: 12px; }
  .mobile-entry-card p { margin: 0; color: var(--muted); font-size: 11px; }
  .dialog-card { padding: 20px; }
  .dialog-actions .btn { flex: 1; }
  .toast { right: 14px; bottom: 78px; max-width: calc(100vw - 28px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
