:root {
  --ink: #102a33;
  --ink-soft: #526870;
  --navy: #0d2f3b;
  --navy-2: #143f4b;
  --teal: #1e7b78;
  --teal-dark: #166461;
  --mint: #dff2ed;
  --mint-2: #edf8f5;
  --sand: #f5f1e8;
  --paper: #fbfcfa;
  --white: #ffffff;
  --line: #dce4e3;
  --line-dark: #c9d5d4;
  --red: #b9473b;
  --red-dark: #93372e;
  --red-wash: #faece9;
  --amber: #ad6c21;
  --shadow: 0 18px 50px rgba(10, 42, 51, 0.08);
  --radius: 20px;
  --radius-sm: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: 0.65; }

.hidden { display: none !important; }

.loading-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  color: var(--ink-soft);
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 5px solid var(--teal);
  position: relative;
}

.brand-mark::before {
  content: "";
  position: absolute;
  width: 5px;
  height: 14px;
  border-radius: 4px;
  background: var(--teal);
  top: 8px;
  left: 19px;
}

.brand-mark span {
  position: absolute;
  width: 12px;
  height: 5px;
  border-radius: 4px;
  background: var(--teal);
  top: 20px;
  left: 19px;
  transform: rotate(30deg);
  transform-origin: left center;
}

.brand-mark.small { width: 34px; height: 34px; border-width: 3px; }
.brand-mark.small::before { width: 3px; height: 9px; top: 5px; left: 13px; }
.brand-mark.small span { width: 8px; height: 3px; top: 13px; left: 13px; }

.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 0.9fr) minmax(440px, 1.1fr); }

.login-story {
  padding: 50px clamp(36px, 6vw, 92px);
  color: white;
  background:
    radial-gradient(circle at 18% 18%, rgba(89, 190, 171, 0.2), transparent 34%),
    linear-gradient(145deg, #0b303b 0%, #0d424b 65%, #145b5a 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.login-story::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  right: -200px;
  bottom: -100px;
  box-shadow: 0 0 0 60px rgba(255,255,255,0.025), 0 0 0 120px rgba(255,255,255,0.018);
}

.wordmark { display: flex; align-items: center; gap: 12px; font-size: 13px; letter-spacing: 0.18em; font-weight: 800; }
.light-wordmark .brand-mark { border-color: #77c7b5; }
.light-wordmark .brand-mark::before, .light-wordmark .brand-mark span { background: #77c7b5; }

.story-copy { max-width: 580px; position: relative; z-index: 1; }
.story-copy h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(44px, 5vw, 76px); line-height: 0.98; letter-spacing: -0.045em; font-weight: 500; margin: 18px 0 24px; }
.story-copy > p:last-child { color: #c7dedb; max-width: 480px; line-height: 1.7; font-size: 17px; }
.privacy-note { font-size: 12px; color: #a9cac6; letter-spacing: 0.04em; }

.login-panel { display: grid; place-items: center; padding: 36px; background: #f7f8f4; }
.auth-card { width: min(100%, 430px); display: grid; gap: 22px; }
.auth-card h2 { font-size: 34px; letter-spacing: -0.035em; margin: 8px 0 8px; }

.eyebrow { margin: 0; color: var(--teal); font-weight: 800; font-size: 11px; text-transform: uppercase; letter-spacing: 0.16em; }
.eyebrow.light { color: #83cfbf; }
.muted { margin: 0; color: var(--ink-soft); line-height: 1.55; }

label { color: var(--ink); font-size: 13px; font-weight: 700; display: grid; gap: 8px; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line-dark);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
textarea { resize: vertical; min-height: 92px; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(30, 123, 120, 0.12); }
input::placeholder, textarea::placeholder { color: #91a0a4; }

.primary-button, .secondary-button, .danger-button, .ai-button, .quiet-button {
  border: 0;
  border-radius: 10px;
  min-height: 42px;
  padding: 10px 17px;
  font-weight: 800;
  font-size: 13px;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}
.primary-button:hover, .secondary-button:hover, .danger-button:hover, .ai-button:hover { transform: translateY(-1px); }
.primary-button { background: var(--teal); color: white; }
.primary-button:hover { background: var(--teal-dark); }
.secondary-button { background: var(--navy); color: white; }
.secondary-button:hover { background: var(--navy-2); }
.danger-button { background: var(--red); color: white; }
.danger-button:hover { background: var(--red-dark); }
.ai-button { background: var(--mint); color: var(--teal-dark); border: 1px solid #bfe1d8; white-space: nowrap; }
.ai-button span { padding-right: 4px; }
.quiet-button { background: transparent; color: var(--ink-soft); padding-inline: 4px; }
.quiet-button:hover { color: var(--ink); }
.quiet-button.bordered { border: 1px solid var(--line-dark); padding-inline: 14px; background: white; }
.full { width: 100%; }

.form-error { color: var(--red-dark); background: var(--red-wash); border-radius: 9px; padding: 10px 12px; margin: 0; font-size: 13px; line-height: 1.4; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 244px; color: white; background: var(--navy); padding: 28px 20px 22px; display: flex; flex-direction: column; z-index: 10; }
.sidebar .wordmark { padding: 0 10px 36px; }
.sidebar .brand-mark { border-color: #74c8b7; }
.sidebar .brand-mark::before, .sidebar .brand-mark span { background: #74c8b7; }
#main-nav { display: grid; gap: 6px; }
.nav-item { border: 0; color: #bcd0d3; background: transparent; border-radius: 10px; display: flex; align-items: center; gap: 12px; padding: 12px 13px; font-size: 13px; font-weight: 700; text-align: left; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: white; }
.nav-item.active { background: rgba(99, 199, 179, 0.15); color: #90e0ce; }
.nav-icon { width: 20px; font-size: 18px; text-align: center; }
.sidebar-foot { margin-top: auto; display: grid; gap: 16px; padding: 0 10px; }
.sidebar-foot .quiet-button { color: #a9c0c3; text-align: left; }
.privacy-chip { color: #a9c0c3; font-size: 10px; line-height: 1.4; text-transform: uppercase; letter-spacing: 0.08em; }
.privacy-chip span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #64c5ae; margin-right: 5px; }

.workspace { grid-column: 2; min-width: 0; }
.topbar { min-height: 105px; padding: 24px clamp(24px, 4vw, 56px); display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); background: rgba(251,252,250,0.92); position: sticky; top: 0; z-index: 8; backdrop-filter: blur(10px); }
.topbar h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; font-size: 31px; letter-spacing: -0.03em; margin: 5px 0 0; }
.profile-pill { display: flex; align-items: center; gap: 10px; padding: 6px 11px 6px 6px; border: 1px solid var(--line); border-radius: 999px; background: white; }
.profile-pill > span:last-child { display: grid; line-height: 1.15; }
.profile-pill strong { font-size: 12px; }
.profile-pill small { color: var(--ink-soft); font-size: 10px; margin-top: 3px; text-transform: capitalize; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--mint); color: var(--teal-dark); font-size: 11px; font-weight: 900; }
.mobile-nav { display: none; }
.view-panel { padding: 34px clamp(24px, 4vw, 56px) 64px; max-width: 1500px; margin: 0 auto; }

.status-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr); gap: 22px; }
.clock-card, .principles-card, .content-card, .toolbar-card, .metric-card { border-radius: var(--radius); }
.clock-card { background: white; border: 1px solid var(--line); padding: clamp(26px, 4vw, 46px); box-shadow: var(--shadow); min-height: 335px; }
.clock-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.clock-heading h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; font-size: 30px; letter-spacing: -0.03em; margin: 8px 0 0; }
.status-badge { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 7px 10px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 800; font-size: 9px; }
.status-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.status-badge.off { background: #eef1f1; color: #687a7f; }
.status-badge.off::before { background: #8d9b9e; }
.status-badge.on { background: var(--mint-2); color: var(--teal-dark); }
.status-badge.on::before { background: #2fa58f; box-shadow: 0 0 0 4px rgba(47,165,143,0.12); }
.timer { font-variant-numeric: tabular-nums; font-size: clamp(49px, 7vw, 86px); letter-spacing: -0.055em; font-weight: 300; margin: 40px 0 5px; color: var(--navy); }
.clock-action { margin-top: 26px; min-width: 150px; min-height: 47px; }
.clock-card.active { border-color: #b7ddd4; box-shadow: 0 18px 55px rgba(25, 104, 100, 0.12); }

.principles-card { color: white; padding: 34px; background: linear-gradient(150deg, #173f49, #0d2f3b); position: relative; overflow: hidden; }
.principles-card::after { content: ""; position: absolute; width: 170px; height: 170px; border: 1px solid rgba(255,255,255,.09); border-radius: 50%; right: -70px; bottom: -70px; }
.principles-card ol { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 19px; }
.principles-card li { display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: center; font-size: 13px; color: #d9e5e4; }
.principles-card li span { color: #77cbbb; font-size: 10px; font-weight: 900; letter-spacing: .08em; border-bottom: 1px solid rgba(119,203,187,.35); padding-bottom: 6px; }

.content-card { background: white; border: 1px solid var(--line); margin-top: 22px; padding: clamp(24px, 3vw, 34px); }
.section-heading { margin-bottom: 23px; }
.section-heading h2 { margin: 7px 0 5px; font-family: Georgia, "Times New Roman", serif; font-size: 27px; letter-spacing: -0.025em; font-weight: 500; }
.split-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.report-form, .stack-form { display: grid; gap: 18px; }
.form-grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.optional { color: #89989c; font-weight: 500; }
.file-field { border: 1px dashed var(--line-dark); border-radius: var(--radius-sm); padding: 16px 18px; display: flex; justify-content: space-between; align-items: center; gap: 18px; background: #fafbf9; }
.file-field strong { font-size: 13px; }
.file-field p { margin: 4px 0 0; color: var(--ink-soft); font-size: 11px; }
.file-button { display: block; position: relative; border: 1px solid var(--line-dark); padding: 10px 13px; border-radius: 9px; background: white; font-size: 11px; white-space: nowrap; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.check-row { grid-template-columns: 18px 1fr; align-items: start; gap: 10px; font-weight: 500; color: var(--ink-soft); line-height: 1.5; }
.check-row input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--teal); }
.clock-out-action { justify-self: start; min-width: 220px; }
.ai-question { background: linear-gradient(90deg, var(--mint-2), #f4faf7); border: 1px solid #cbe6df; border-left: 4px solid var(--teal); border-radius: 10px; padding: 14px 16px; margin: -7px 0 22px; font-family: Georgia, "Times New Roman", serif; font-size: 17px; line-height: 1.45; color: #164f4d; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { color: #718388; text-transform: uppercase; letter-spacing: .09em; font-size: 9px; font-weight: 900; text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); }
td { padding: 15px 12px; border-bottom: 1px solid #e8eeed; vertical-align: top; line-height: 1.45; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdfc; }
.table-primary { font-weight: 800; color: var(--ink); display: block; }
.table-secondary { color: var(--ink-soft); font-size: 10px; display: block; margin-top: 3px; }
.work-cell { max-width: 420px; }
.empty-state { color: var(--ink-soft); text-align: center; padding: 34px 10px 18px; margin: 0; }
.detail-button { border: 1px solid var(--line-dark); background: white; color: var(--ink); font-weight: 700; font-size: 10px; padding: 7px 9px; border-radius: 8px; }

.toolbar-card { background: var(--sand); border: 1px solid #e4ded1; padding: 18px; display: grid; grid-template-columns: 170px minmax(190px, .8fr) minmax(250px, 1.4fr) auto; gap: 13px; align-items: end; }
.toolbar-card label { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: #6c756f; }
.toolbar-card input, .toolbar-card select { background: rgba(255,255,255,.82); text-transform: none; letter-spacing: 0; font-size: 12px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 18px; }
.metric-card { background: white; border: 1px solid var(--line); padding: 19px 21px; display: grid; gap: 5px; }
.metric-card span { color: var(--ink-soft); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.metric-card strong { font-family: Georgia, "Times New Roman", serif; font-weight: 500; font-size: 31px; letter-spacing: -.03em; }
.metric-card small { color: #8a989b; font-size: 10px; }
.metric-card.accent { background: var(--navy); color: white; border-color: var(--navy); }
.metric-card.accent span, .metric-card.accent small { color: #aac3c6; }
.ask-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.ai-answer { margin-top: 16px; border-radius: 10px; background: var(--mint-2); border: 1px solid #cbe6df; padding: 15px 17px; color: #154e4c; line-height: 1.6; font-size: 13px; white-space: pre-wrap; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }
.report-table-wrap { max-height: 600px; }

.team-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .65fr); gap: 22px; align-items: start; }
.team-grid .content-card { margin-top: 0; }
.team-list { display: grid; }
.team-row { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(120px, .55fr) auto; align-items: center; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.team-row:last-child { border-bottom: 0; }
.person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.person .avatar { flex: 0 0 auto; }
.person-copy { min-width: 0; }
.person-copy strong, .person-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-copy strong { font-size: 13px; }
.person-copy small { color: var(--ink-soft); margin-top: 3px; font-size: 10px; }
.account-state { font-size: 10px; color: var(--ink-soft); }
.account-state strong { display: block; color: var(--ink); text-transform: capitalize; margin-bottom: 3px; }
.team-actions { display: flex; gap: 6px; justify-content: flex-end; }
.tiny-button { border: 1px solid var(--line-dark); background: white; color: var(--ink); border-radius: 8px; padding: 7px 9px; font-size: 9px; font-weight: 800; }
.tiny-button.warn { color: var(--red-dark); border-color: #e4c4c0; background: #fffafa; }
.create-card { position: sticky; top: 128px; }
.helper { color: #7f8f93; font-size: 10px; line-height: 1.5; margin: -7px 0 0; }
.input-action { display: grid; grid-template-columns: 1fr auto; }
.input-action input { border-radius: 10px 0 0 10px; }
.input-action button { border: 1px solid var(--line-dark); border-left: 0; border-radius: 0 10px 10px 0; background: var(--mint-2); color: var(--teal-dark); font-size: 10px; font-weight: 800; padding-inline: 11px; }

.modal { width: min(92vw, 480px); border: 0; border-radius: var(--radius); padding: 30px; color: var(--ink); box-shadow: 0 30px 100px rgba(0,0,0,.22); }
.modal::backdrop { background: rgba(7, 27, 33, .65); backdrop-filter: blur(4px); }
.modal form { display: grid; gap: 17px; }
.modal h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; font-size: 30px; letter-spacing: -.03em; margin: -5px 0 -8px; }
.modal-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: var(--mint); color: var(--teal-dark); font-size: 22px; }
.modal-close { position: absolute; right: 18px; top: 15px; background: transparent; border: 0; font-size: 27px; color: var(--ink-soft); }
.detail-modal { width: min(94vw, 720px); }
.detail-modal h2 { margin: 8px 0 20px; }
.detail-content { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.detail-block { min-width: 0; }
.detail-block.wide { grid-column: 1 / -1; }
.detail-block span { display: block; color: #718388; text-transform: uppercase; letter-spacing: .09em; font-size: 9px; font-weight: 900; margin-bottom: 6px; }
.detail-block p, .detail-block pre { margin: 0; font-size: 12px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; }
.detail-block pre { max-height: 240px; overflow: auto; background: #f4f6f4; padding: 13px; border-radius: 9px; border: 1px solid var(--line); }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 30; max-width: 380px; border-radius: 10px; padding: 13px 16px; color: white; background: var(--navy); box-shadow: 0 15px 40px rgba(7, 31, 38, .22); font-size: 12px; font-weight: 700; }
.toast.error { background: var(--red-dark); }

@media (max-width: 1050px) {
  .status-grid, .team-grid { grid-template-columns: 1fr; }
  .principles-card ol { grid-template-columns: 1fr 1fr; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .toolbar-card { grid-template-columns: 1fr 1fr; }
  .create-card { position: static; }
}

@media (max-width: 760px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-story { min-height: 38vh; padding: 28px; }
  .story-copy h1 { font-size: 42px; margin-bottom: 13px; }
  .story-copy > p:last-child { font-size: 14px; }
  .privacy-note { display: none; }
  .login-panel { padding: 42px 24px; place-items: start center; }
  .sidebar { display: none; }
  .app-shell { display: block; }
  .workspace { grid-column: auto; }
  .topbar { min-height: 86px; padding: 18px 20px; position: static; }
  .topbar h1 { font-size: 25px; }
  .profile-pill > span:last-child { display: none; }
  .mobile-nav { display: flex; gap: 6px; padding: 10px 20px; border-bottom: 1px solid var(--line); overflow-x: auto; background: white; }
  .mobile-nav-item { border: 0; background: transparent; color: var(--ink-soft); border-radius: 8px; padding: 8px 12px; font-size: 11px; font-weight: 800; white-space: nowrap; }
  .mobile-nav-item.active { background: var(--mint); color: var(--teal-dark); }
  .view-panel { padding: 22px 16px 50px; }
  .status-grid { gap: 14px; }
  .clock-card, .principles-card, .content-card { border-radius: 16px; }
  .clock-card { min-height: 300px; padding: 24px; }
  .clock-heading { display: grid; }
  .timer { margin-top: 30px; font-size: 52px; }
  .principles-card { padding: 25px; }
  .principles-card ol { grid-template-columns: 1fr; }
  .content-card { padding: 21px; margin-top: 14px; }
  .split-heading { display: grid; }
  .form-grid.two, .detail-content { grid-template-columns: 1fr; }
  .detail-block.wide { grid-column: auto; }
  .file-field { align-items: flex-start; flex-direction: column; }
  .clock-out-action { width: 100%; }
  .toolbar-card { grid-template-columns: 1fr; border-radius: 16px; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-card { padding: 15px; border-radius: 14px; }
  .metric-card strong { font-size: 26px; }
  .ask-row { grid-template-columns: 1fr; }
  .team-row { grid-template-columns: 1fr; }
  .team-actions { justify-content: flex-start; }
  .button-row { width: 100%; }
  .button-row button { flex: 1; }
  .modal { padding: 25px 22px; }
  .toast { left: 16px; right: 16px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
