:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --ink: #192026;
  --muted: #66717d;
  --panel: #ffffff;
  --line: #d9dee5;
  --accent: #007a5a;
  --accent-2: #d1495b;
  --accent-3: #f2b705;
  --accent-4: #2563eb;
  --shadow: 0 18px 45px rgba(31, 41, 55, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    repeating-linear-gradient(90deg, rgba(25, 32, 38, 0.035) 0 1px, transparent 1px 72px),
    linear-gradient(135deg, #f6f7f9 0%, #eef3f1 45%, #f7f4ec 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 40px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.eyebrow,
.panel-label {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.top-bar .eyebrow {
  margin-bottom: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 3.4rem;
  line-height: 1;
}

.controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(54px, 1fr));
  padding: 4px;
  background: #e8edf2;
  border: 1px solid #d4dbe4;
  border-radius: 8px;
}

.segment {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.segment.active {
  color: #ffffff;
  background: var(--ink);
}

.view-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 18px;
  padding: 5px;
  background: #e8edf2;
  border: 1px solid #d4dbe4;
  border-radius: 8px;
}

.view-tab {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}

.view-tab.active {
  color: #ffffff;
  background: var(--ink);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.hero-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 92px;
  margin-bottom: 18px;
  padding: 16px 20px;
  overflow: hidden;
  color: #ffffff;
  background:
    linear-gradient(90deg, rgba(25, 32, 38, 0.93), rgba(25, 32, 38, 0.76)),
    repeating-linear-gradient(90deg, transparent 0 26px, rgba(255, 255, 255, 0.12) 26px 27px);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-panel h2 {
  max-width: 620px;
  margin-bottom: 0;
  font-size: 1.65rem;
  line-height: 1.16;
}

.hero-panel .panel-label {
  color: #8ee6c9;
}

.home-location {
  display: grid;
  gap: 3px;
}

.home-location .panel-label {
  margin-bottom: 0;
}

.home-location strong {
  font-size: 1.22rem;
  line-height: 1.1;
}

.home-clock {
  display: grid;
  gap: 4px;
  min-width: 210px;
  padding-left: 18px;
  border-left: 1px solid rgba(255, 255, 255, 0.24);
  text-align: right;
}

#home-time {
  font-variant-numeric: tabular-nums;
  font-size: 2.15rem;
  font-weight: 850;
  line-height: 1;
}

#home-date {
  color: rgba(255, 255, 255, 0.74);
  font-weight: 700;
}

.clock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
}

.clock-card {
  display: grid;
  gap: 20px;
  min-height: 300px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 5px solid var(--card-color, var(--accent));
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(31, 41, 55, 0.08);
}

.card-topline {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
}

.country-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  width: 66px;
  height: 62px;
  flex: 0 0 66px;
  color: #ffffff;
  background: var(--card-color, var(--accent));
  border-radius: 8px;
  font-weight: 900;
}

.mark-code {
  line-height: 1;
}

.temp-value {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.76rem;
  line-height: 1;
}

.temp-value::before {
  content: "";
  width: 5px;
  height: 15px;
  border: 2px solid currentColor;
  border-radius: 999px;
  box-shadow: inset 0 -5px 0 currentColor;
}

.country-name {
  margin-bottom: 4px;
  font-size: 1.12rem;
  line-height: 1.15;
}

.city-name {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 700;
}

.time-block {
  text-align: center;
}

.digital-time {
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
  font-size: 2.45rem;
  font-weight: 900;
  line-height: 1;
}

.date-line {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 700;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.meta-grid div {
  min-width: 0;
  padding: 11px;
  border: 1px solid #e1e6eb;
  border-radius: 8px;
  background: #fafbfc;
}

.meta-grid dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 800;
  text-transform: uppercase;
}

.meta-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 850;
}

.focus-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(320px, 1.08fr);
  gap: 18px;
}

.focus-card,
.timer-card,
.holiday-toolbar,
.holiday-card,
.table-toolbar,
.time-table-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(31, 41, 55, 0.08);
}

.focus-card,
.timer-card {
  min-height: 460px;
  padding: 22px;
}

.focus-card {
  display: grid;
  align-content: start;
  gap: 16px;
}

.focus-card h2,
.holiday-toolbar h2 {
  margin-bottom: 0;
  font-size: 1.75rem;
}

.field-label,
.duration-field span,
.year-pill span,
.sync-pill span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

textarea,
input {
  color: var(--ink);
  background: #fbfcfd;
  border: 1px solid #d4dbe4;
  border-radius: 8px;
}

textarea {
  width: 100%;
  min-height: 130px;
  padding: 13px;
  resize: vertical;
}

textarea:focus,
input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(0, 122, 90, 0.16);
}

.duration-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: end;
  gap: 10px;
}

.duration-field,
.year-pill,
.sync-pill {
  display: grid;
  gap: 6px;
}

.duration-field input,
.year-pill strong,
.sync-pill strong {
  min-height: 44px;
  padding: 8px 12px;
  font-weight: 850;
}

.year-pill strong,
.sync-pill strong {
  display: grid;
  align-items: center;
  color: var(--ink);
  background: #fbfcfd;
  border: 1px solid #d4dbe4;
  border-radius: 8px;
}

.icon-button,
.primary-action,
.secondary-action {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  font-weight: 850;
  cursor: pointer;
}

.icon-button {
  color: #ffffff;
  background: var(--ink);
  font-size: 1.25rem;
}

.timer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.primary-action {
  color: #ffffff;
  background: var(--accent);
}

.secondary-action {
  color: var(--ink);
  background: #e8edf2;
}

.secondary-action:disabled {
  color: #9aa4af;
  cursor: not-allowed;
}

.timer-card {
  display: grid;
  align-content: center;
  gap: 16px;
  color: #ffffff;
  background:
    linear-gradient(120deg, rgba(25, 32, 38, 0.96), rgba(25, 32, 38, 0.74)),
    repeating-linear-gradient(90deg, transparent 0 26px, rgba(255, 255, 255, 0.12) 26px 27px);
}

.timer-card .panel-label {
  color: #8ee6c9;
}

.current-task {
  min-height: 28px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 1.05rem;
  font-weight: 800;
}

.focus-timer {
  margin-bottom: 0;
  font-variant-numeric: tabular-nums;
  font-size: 5rem;
  font-weight: 900;
  line-height: 1;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

#focus-progress {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--accent-3);
  border-radius: inherit;
  transition: width 180ms linear;
}

.focus-status {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 850;
}

.table-toolbar,
.holiday-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 18px;
}

.table-toolbar h2,
.holiday-toolbar h2 {
  margin-bottom: 0;
  font-size: 1.75rem;
}

.year-pill,
.sync-pill {
  width: 140px;
}

.table-toolbar-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.table-action {
  min-height: 44px;
  padding: 8px 13px;
}

.time-table-card {
  overflow: hidden;
}

.timeline-scroll {
  width: 100%;
  overflow: hidden;
}

.timeline-heading,
.timeline-row {
  display: grid;
  grid-template-columns: 190px 140px minmax(0, 1fr);
  min-width: 0;
}

.timeline-heading {
  color: var(--muted);
  background: #f7f9fb;
  border-bottom: 1px solid #e1e6eb;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.timeline-heading span {
  padding: 10px 12px;
}

.timeline-row {
  min-height: 76px;
  border-bottom: 1px solid #e1e6eb;
}

.timeline-row[hidden] {
  display: none;
}

.timeline-row:last-child {
  border-bottom: 0;
}

.timeline-place,
.timeline-now {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #ffffff;
}

.timeline-place > div {
  min-width: 0;
}

.timeline-home {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  color: #ffffff;
  background: var(--row-color, var(--accent));
  border-radius: 8px;
  font-weight: 900;
}

.remove-country {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-left: auto;
  border: 0;
  border-radius: 50%;
  color: #87919b;
  background: #eef2f6;
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.remove-country:hover,
.remove-country:focus-visible {
  color: #ffffff;
  background: var(--accent-2);
}

.timeline-city {
  margin-bottom: 3px;
  font-size: 0.98rem;
  line-height: 1.1;
}

.timeline-country,
.timeline-current-date {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.timeline-now {
  align-items: flex-start;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  border-left: 1px solid #edf1f4;
  border-right: 1px solid #edf1f4;
}

.timeline-current-time {
  font-variant-numeric: tabular-nums;
  font-size: 1.35rem;
  line-height: 1;
}

.timeline-hours {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  min-width: 0;
  background: #f6f9fc;
}

.timeline-hour {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 76px;
  color: #66717d;
  background: #ffffff;
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  border-right: 1px solid #e1e6eb;
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  font-weight: 850;
  cursor: pointer;
  user-select: none;
}

.timeline-hour.day {
  background: #ffffff;
}

.timeline-hour.evening {
  background: #ffffff;
}

.timeline-hour.night {
  color: #66717d;
  background: #ffffff;
}

.timeline-hour.current {
  color: #66717d;
  background: #ffffff;
}

.timeline-hour.selected {
  color: #192026;
  background: #ffe58f;
  outline: 2px solid #c99400;
  outline-offset: -2px;
}

.timeline-date-marker {
  position: absolute;
  top: 7px;
  left: 3px;
  color: #6c7b8b;
  font-size: 0.46rem;
  font-weight: 900;
  text-transform: uppercase;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

thead th:first-child,
tbody th {
  width: 250px;
}

thead th:nth-child(2),
tbody td:nth-child(2) {
  width: 170px;
}

th,
td {
  padding: 15px 16px;
  border-bottom: 1px solid #e1e6eb;
  text-align: left;
  vertical-align: middle;
}

thead th {
  color: var(--muted);
  background: #f7f9fb;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fafbfc;
}

.table-country {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table-country strong,
.table-country small {
  display: block;
}

.table-country small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.table-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  color: #ffffff;
  background: var(--row-color, var(--accent));
  border-radius: 8px;
  font-weight: 900;
}

.table-time {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-size: 1.5rem;
  font-weight: 900;
}

.table-date,
.table-temp,
.table-gmt,
.table-diff {
  font-weight: 850;
}

.status-pill {
  display: inline-grid;
  place-items: center;
  min-height: 32px;
  padding: 6px 10px;
  color: var(--ink);
  background: #e8edf2;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 850;
}

.holiday-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.holiday-card {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 310px;
  padding: 18px;
  border-top: 5px solid var(--card-color, var(--accent));
}

.holiday-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.holiday-state {
  color: var(--muted);
  font-weight: 800;
}

.holiday-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.holiday-list li {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid #e1e6eb;
  border-radius: 8px;
  background: #fafbfc;
}

.holiday-date {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.holiday-name {
  min-width: 0;
  font-weight: 850;
}

.holiday-local {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 520px);
    padding-top: 18px;
  }

  .top-bar,
  .hero-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-panel {
    align-items: center;
    flex-direction: row;
    gap: 14px;
    min-height: 82px;
    padding: 14px 16px;
  }

  .home-location strong {
    font-size: 1rem;
  }

  .home-clock {
    min-width: 0;
    padding-left: 14px;
  }

  #home-time {
    font-size: 1.75rem;
  }

  #home-date {
    font-size: 0.76rem;
  }

  .controls {
    justify-content: space-between;
  }

  h1 {
    font-size: 2.35rem;
  }

  .segmented {
    flex: 1 1 156px;
  }

  .home-clock {
    min-width: 0;
    padding-top: 18px;
    padding-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.24);
    border-left: 0;
    text-align: left;
  }

  .clock-card {
    min-height: auto;
  }

  .view-tabs,
  .timer-actions {
    grid-template-columns: 1fr;
  }

  .focus-layout {
    grid-template-columns: 1fr;
  }

  .focus-card,
  .timer-card {
    min-height: auto;
  }

  .focus-timer {
    font-size: 3.7rem;
  }

  .timeline-heading,
  .timeline-row {
    grid-template-columns: minmax(0, 1fr) 110px;
    min-width: 0;
  }

  .timeline-heading span:nth-child(3) {
    display: none;
  }

  .timeline-row {
    grid-template-areas:
      "place now"
      "hours hours";
  }

  .timeline-place {
    grid-area: place;
  }

  .timeline-now {
    grid-area: now;
  }

  .timeline-hours {
    grid-area: hours;
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .timeline-place,
  .timeline-now {
    gap: 8px;
    padding: 10px;
  }

  .timeline-home {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .timeline-city {
    font-size: 0.96rem;
  }

  .timeline-current-time {
    font-size: 1.32rem;
  }

  .timeline-current-date {
    font-size: 0.68rem;
  }

  .table-toolbar,
  .holiday-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .table-toolbar-actions {
    justify-content: stretch;
  }

  .table-action {
    flex: 1 1 120px;
  }

  .year-pill,
  .sync-pill {
    width: 100%;
  }
}

@media print {
  @page {
    size: landscape;
    margin: 10mm;
  }

  body {
    background: #ffffff;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .top-bar,
  .view-tabs,
  .table-action,
  .remove-country,
  .tab-panel:not(#time-table-panel) {
    display: none !important;
  }

  #time-table-panel {
    display: block !important;
  }

  .table-toolbar,
  .time-table-card {
    box-shadow: none;
  }

  .table-toolbar {
    margin-bottom: 8px;
    padding: 10px;
  }

  .table-toolbar h2 {
    font-size: 1.2rem;
  }

  .timeline-heading,
  .timeline-row {
    grid-template-columns: 145px 105px minmax(0, 1fr);
  }

  .timeline-row {
    min-height: 52px;
  }

  .timeline-place,
  .timeline-now {
    gap: 6px;
    padding: 5px 7px;
  }

  .timeline-home {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
    font-size: 0.7rem;
  }

  .timeline-city {
    font-size: 0.78rem;
  }

  .timeline-country,
  .timeline-current-date {
    font-size: 0.62rem;
  }

  .timeline-current-time {
    font-size: 0.95rem;
  }

  .timeline-hour {
    min-height: 52px;
    font-size: 0.58rem;
  }

  .timeline-date-marker {
    top: 3px;
    left: 2px;
    font-size: 0.36rem;
  }
}
