:root {
  --navy: #0a3d62;
  --navy-2: #0f4f7c;
  --teal: #10a889;
  --teal-dark: #07836c;
  --orange: #f2a33a;
  --red: #d95050;
  --ink: #162334;
  --muted: #667386;
  --line: #dce3ec;
  --surface: #ffffff;
  --surface-soft: #f4f7fb;
  --surface-blue: #eaf2f8;
  --shadow: 0 16px 42px rgba(20, 44, 69, 0.09);
  --radius: 20px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--surface-soft); }
body { margin: 0; min-height: 100vh; background: var(--surface-soft); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
  background:
    radial-gradient(circle at 15% 10%, rgba(16,168,137,.16), transparent 33%),
    radial-gradient(circle at 90% 90%, rgba(10,61,98,.18), transparent 38%),
    linear-gradient(145deg, #f8fbfe, #edf4f8);
}

.login-shell { width: min(100%, 440px); }
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand img { display: block; margin: 0 auto 8px; }
.login-brand p { margin: 0; color: var(--muted); font-weight: 650; }

.panel {
  background: var(--surface);
  border: 1px solid rgba(215, 224, 234, .88);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.login-card { padding: 28px; }
.login-card h1 { margin: 0 0 6px; font-size: 1.7rem; }
.login-card > p { margin-top: 0; }

label { display: grid; gap: 7px; margin: 15px 0; color: #334155; font-weight: 650; font-size: .91rem; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  min-height: 46px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(16, 168, 137, .12);
}

.button {
  border: 0;
  border-radius: 12px;
  min-height: 44px;
  padding: 11px 16px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: transform .12s, opacity .12s, background .12s;
}
.button:active { transform: translateY(1px); }
.button:disabled { opacity: .48; cursor: not-allowed; }
.button.primary { background: var(--navy); color: #fff; }
.button.primary:hover { background: var(--navy-2); }
.button.secondary { background: #e8f0f6; color: var(--navy); }
.button.ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.button.danger { background: #fff0f0; color: #b92828; }
.button.full { width: 100%; }
.button.small { min-height: 36px; padding: 8px 12px; font-size: .85rem; }

.language-row { display: flex; justify-content: center; gap: 7px; margin-top: 20px; }
.language-row button {
  border: 0; background: transparent; color: var(--muted); font-weight: 750; padding: 7px 9px;
}
.language-row button.active { color: var(--navy); background: rgba(255,255,255,.7); border-radius: 8px; }

.app-shell { min-height: 100vh; }
.app-header {
  position: sticky; top: 0; z-index: 20;
  height: 66px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 max(18px, calc((100vw - 1120px) / 2));
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(216, 225, 235, .9);
}
.brand-link { display: flex; align-items: center; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.icon-button {
  width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 11px;
  background: #fff; color: var(--navy); font-size: 1.2rem; display: grid; place-items: center;
}
.compact-select { width: auto; min-height: 40px; padding: 7px 28px 7px 10px; border-radius: 10px; }
.sync-badge { font-size: .76rem; font-weight: 750; color: var(--orange); background: #fff6e8; padding: 7px 10px; border-radius: 999px; }

.main-content { max-width: 1120px; margin: 0 auto; padding: 26px 18px calc(90px + var(--safe-bottom)); }
.view { display: none; }
.view.active-view { display: block; }
.welcome-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin: 8px 0 20px; }
.welcome-row h1, .page-heading h1 { margin: 3px 0 3px; font-size: clamp(1.65rem, 4vw, 2.3rem); }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: .09em; font-size: .73rem; font-weight: 800; color: var(--teal-dark); }
.muted { color: var(--muted); }
.welcome-row .muted { margin: 0; }
.live-clock { font-size: clamp(1.55rem, 5vw, 2.4rem); font-weight: 820; color: var(--navy); font-variant-numeric: tabular-nums; }

.clock-panel { padding: 24px; margin-bottom: 18px; overflow: hidden; position: relative; }
.clock-panel::after {
  content: ""; position: absolute; width: 210px; height: 210px; border-radius: 50%;
  right: -115px; top: -120px; background: rgba(16,168,137,.08); pointer-events: none;
}
.status-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 22px; }
.field-label { display: block; color: var(--muted); font-size: .78rem; font-weight: 700; margin-bottom: 6px; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 999px; font-size: .88rem; }
.status-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-pill.stopped { color: #687385; background: #edf0f4; }
.status-pill.working { color: #08775f; background: #e3f8f2; }
.status-pill.paused { color: #9b630f; background: #fff4dc; }
.today-total { text-align: right; }
.today-total strong { display: block; color: var(--navy); font-size: 1.42rem; font-variant-numeric: tabular-nums; }
.project-field { margin-bottom: 20px; }

.clock-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.clock-button {
  border: 0; border-radius: 17px; min-height: 86px; padding: 16px;
  color: #fff; font-size: 1.05rem; font-weight: 850; letter-spacing: .02em;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  box-shadow: 0 13px 26px rgba(10, 61, 98, .16);
  transition: transform .12s, filter .12s;
}
.clock-button:active { transform: scale(.985); }
.clock-button:hover { filter: brightness(1.03); }
.clock-button.start { grid-column: 1 / -1; background: linear-gradient(135deg, var(--navy), #17658f); min-height: 104px; }
.clock-button.pause { background: linear-gradient(135deg, #d88a20, var(--orange)); }
.clock-button.resume { background: linear-gradient(135deg, #06826c, var(--teal)); }
.clock-button.stop { background: linear-gradient(135deg, #b93434, var(--red)); }
.clock-button-icon { font-size: 1.35rem; line-height: 1; }
.location-message { display: flex; align-items: center; gap: 9px; margin-top: 17px; color: var(--muted); font-size: .82rem; }
.location-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); flex: none; }
.location-message.warning .location-dot { background: var(--orange); }
.location-message.error .location-dot { background: var(--red); }

.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; font-size: 1.2rem; }
.page-heading { margin: 8px 0 18px; }
.timeline { display: grid; }
.timeline-empty { color: var(--muted); text-align: center; padding: 26px 10px; }
.timeline-item { display: grid; grid-template-columns: 45px 1fr auto; gap: 13px; padding: 13px 0; border-bottom: 1px solid #edf1f5; align-items: center; }
.timeline-item:last-child { border-bottom: 0; }
.timeline-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 850; background: var(--surface-blue); color: var(--navy); }
.timeline-item.pending .timeline-icon { background: #fff4dc; color: #9b630f; }
.timeline-copy strong { display: block; font-size: .94rem; }
.timeline-copy small { display: block; color: var(--muted); margin-top: 3px; }
.timeline-time { text-align: right; font-weight: 780; font-variant-numeric: tabular-nums; }
.timeline-time small { display: block; color: var(--muted); font-size: .68rem; margin-top: 3px; }
.offline-panel { margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.offline-panel p { margin: 4px 0 0; font-size: .84rem; }
.network-pill { padding: 7px 10px; border-radius: 999px; font-size: .75rem; font-weight: 780; white-space: nowrap; }
.network-pill.online { color: #08775f; background: #e3f8f2; }
.network-pill.offline { color: #9b630f; background: #fff4dc; }

.bottom-nav {
  position: fixed; z-index: 30; bottom: 0; left: 0; right: 0;
  min-height: calc(68px + var(--safe-bottom));
  padding: 8px 18px var(--safe-bottom);
  display: flex; justify-content: center; gap: 8px;
  background: rgba(255,255,255,.96); backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.bottom-nav-button { min-width: 100px; border: 0; background: transparent; color: var(--muted); padding: 6px 15px; border-radius: 12px; display: grid; place-items: center; gap: 1px; }
.bottom-nav-button span { font-size: 1.3rem; line-height: 1; }
.bottom-nav-button small { font-size: .7rem; font-weight: 750; }
.bottom-nav-button.active { color: var(--navy); background: var(--surface-blue); }

.tabbar { display: flex; overflow-x: auto; gap: 8px; padding: 3px 0 14px; margin-bottom: 4px; scrollbar-width: none; }
.tabbar::-webkit-scrollbar { display: none; }
.tab { white-space: nowrap; border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px; padding: 9px 13px; font-weight: 740; }
.tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.admin-panel { display: none; }
.admin-panel.active-admin-panel { display: block; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 18px; }
.summary-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 17px; box-shadow: 0 8px 26px rgba(20,44,69,.055); }
.summary-card span { display: block; color: var(--muted); font-size: .78rem; }
.summary-card strong { display: block; font-size: 1.75rem; color: var(--navy); margin-top: 7px; }
.responsive-table { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 660px; }
.table th, .table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid #edf1f5; font-size: .86rem; vertical-align: middle; }
.table th { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.table td:last-child, .table th:last-child { text-align: right; }
.mini-status { display: inline-flex; padding: 5px 8px; border-radius: 999px; font-size: .7rem; font-weight: 800; }
.mini-status.working { color: #08775f; background: #e3f8f2; }
.mini-status.paused { color: #9b630f; background: #fff4dc; }
.mini-status.stopped { color: #687385; background: #edf0f4; }

.two-column { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 18px; align-items: start; }
.form-card h2, .panel > h2 { margin: 0 0 16px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.checkbox-label { display: flex; align-items: center; gap: 10px; }
.checkbox-label input { width: 19px; min-height: 19px; margin: 0; }
.stack-list { display: grid; gap: 10px; }
.stack-item { border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.stack-item strong { display: block; }
.stack-item small { display: block; color: var(--muted); margin-top: 4px; }
.stack-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.wide-form { max-width: 820px; }
.integration-box { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.integration-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.integration-card strong { display: block; margin-bottom: 5px; }
.integration-card small { color: var(--muted); }

.form-message { min-height: 1.2em; margin: 10px 0 0; color: var(--red); font-size: .84rem; }
.form-message.success { color: var(--teal-dark); }
.form-message.centered { text-align: center; }

body:has(dialog[open]) { overflow: hidden; }
dialog { border: 0; padding: 0; border-radius: 20px; width: min(calc(100% - 30px), 520px); box-shadow: 0 30px 90px rgba(0,0,0,.24); }
dialog::backdrop { background: rgba(11, 25, 39, .54); backdrop-filter: blur(3px); }
.dialog-card { padding: 22px; }
.dialog-card .section-heading { margin-bottom: 8px; }
.toast { position: fixed; z-index: 80; left: 50%; bottom: calc(86px + var(--safe-bottom)); transform: translateX(-50%); max-width: min(90vw, 500px); background: #152535; color: #fff; border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow); font-weight: 680; }

@media (min-width: 780px) {
  #clockView { max-width: 760px; margin: 0 auto; }
  .bottom-nav { position: sticky; bottom: 0; width: max-content; margin: 0 auto 18px; border: 1px solid var(--line); border-radius: 18px; min-height: auto; padding: 7px; box-shadow: var(--shadow); }
  .main-content { padding-bottom: 24px; }
  .toast { bottom: 28px; }
}

@media (max-width: 820px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .two-column { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .app-header { padding: 0 15px; }
  .main-content { padding: 20px 14px calc(90px + var(--safe-bottom)); }
  .panel { padding: 18px; border-radius: 17px; }
  .welcome-row { align-items: center; }
  .welcome-row h1 { font-size: 1.48rem; }
  .live-clock { font-size: 1.42rem; }
  .clock-actions { grid-template-columns: 1fr; }
  .clock-button.start { grid-column: auto; }
  .clock-button { min-height: 76px; }
  .field-grid { grid-template-columns: 1fr; gap: 0; }
  .integration-box { grid-template-columns: 1fr; }
  .offline-panel { align-items: flex-start; }
  .summary-grid { gap: 9px; }
  .summary-card { padding: 13px; }
  .summary-card strong { font-size: 1.4rem; }
  .section-heading { align-items: flex-start; }
}
.account-link { text-align: center; margin: 18px 0 0 !important; font-size: .86rem; }
.account-link a { color: var(--navy); font-weight: 750; }
.invite-note { margin: 8px 0 2px; font-size: .84rem; line-height: 1.45; }
.invite-status { font-weight: 700; }
.invite-status.sent { color: var(--teal-dark); }
.invite-status.failed { color: var(--red); }
.report-filter { display: grid; grid-template-columns: 1fr 170px 170px auto; gap: 14px; align-items: end; margin-bottom: 18px; }
.report-filter h2 { margin: 0 0 5px; }
.report-filter p { margin: 0; }
.report-filter label { margin: 0; }
.report-downloads { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.report-exceptions-panel { margin-top: 18px; }
@media (max-width: 900px) {
  .report-filter { grid-template-columns: 1fr 1fr; }
  .report-filter > div { grid-column: 1 / -1; }
  .report-filter .button { align-self: end; }
}
@media (max-width: 560px) {
  .report-filter { grid-template-columns: 1fr; }
  .report-filter > div { grid-column: auto; }
  .report-downloads { justify-content: flex-start; }
  .report-heading { display: grid; }
}
.billing-panel { max-width: 820px; margin-top: 18px; }
.billing-panel .section-heading { align-items: center; }
.billing-panel .section-heading p { margin: 5px 0 0; max-width: 560px; }
.billing-status-card {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
  margin-top: 14px;
}
.billing-status-item { border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.billing-status-item small { display: block; color: var(--muted); margin-bottom: 5px; }
.billing-status-item strong { color: var(--navy); overflow-wrap: anywhere; }
@media (max-width: 680px) {
  .billing-panel .section-heading { display: grid; }
  .billing-panel .section-heading .button { width: 100%; }
  .billing-status-card { grid-template-columns: 1fr; }
}
