:root {
  color-scheme: light;
  --background: #f4f7fb;
  --surface: #ffffff;
  --surface-alt: #eef4ff;
  --text: #172033;
  --muted: #697386;
  --border: #dfe5ef;
  --primary: #1f6feb;
  --primary-dark: #1557b0;
  --danger: #c93c37;
  --danger-soft: #fff0ef;
  --success: #168454;
  --shadow: 0 14px 34px rgba(25, 45, 85, 0.08);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--background);
}

body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(31, 111, 235, 0.12), transparent 30rem),
    var(--background);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

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

h1 {
  margin-bottom: 4px;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.05em;
}

h2 {
  margin-bottom: 0;
  font-size: 1.28rem;
  letter-spacing: -0.025em;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.subtitle,
.muted {
  color: var(--muted);
}

.subtitle {
  margin-bottom: 0;
}

.container {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 44px;
}

.card {
  margin-bottom: 22px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(223, 229, 239, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.timer-card {
  background: linear-gradient(135deg, #14213d, #1f396a);
  color: white;
  border: none;
}

.timer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.status-label {
  display: inline-block;
  margin-bottom: 8px;
  color: #c7d6f4;
  font-size: 0.9rem;
}

.live-time {
  font-size: clamp(2.8rem, 9vw, 5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}

.timer-dot {
  width: 16px;
  height: 16px;
  margin-top: 8px;
  border-radius: 50%;
  background: #77839b;
  box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.06);
}

.timer-dot.active {
  background: #46d38a;
}

.timer-dot.break {
  background: #f3bf55;
}

.timer-info {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 24px 0 0;
}

.timer-info div {
  padding: 14px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 14px;
}

.timer-info span,
.timer-info strong {
  display: block;
}

.timer-info span {
  margin-bottom: 4px;
  color: #b9c8e7;
  font-size: 0.8rem;
}

.timer-actions,
.form-actions,
.toolbar,
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.timer-actions {
  margin-top: 22px;
}

button,
.file-button {
  border: none;
  border-radius: 12px;
  padding: 11px 16px;
  font-weight: 750;
  transition: transform 0.15s ease, background-color 0.15s ease, opacity 0.15s ease;
}

button:hover,
.file-button:hover {
  transform: translateY(-1px);
}

button:active,
.file-button:active {
  transform: translateY(0);
}

.primary {
  color: white;
  background: var(--primary);
}

.primary:hover {
  background: var(--primary-dark);
}

.secondary {
  color: var(--text);
  background: #edf2f8;
}

.danger {
  color: #fff;
  background: var(--danger);
}

.large {
  min-height: 52px;
  flex: 1 1 220px;
}

.icon-button {
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 1.1rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}

.summary-card {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.summary-card span,
.summary-card strong,
.summary-card small {
  display: block;
}

.summary-card span {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.84rem;
}

.summary-card strong {
  font-size: clamp(1.7rem, 5vw, 2.35rem);
  letter-spacing: -0.04em;
}

.summary-card small {
  margin-top: 3px;
  color: var(--muted);
}

.section-header {
  margin-bottom: 20px;
}

.section-header.responsive {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
}

.entry-form label,
.dialog-card label,
.compact {
  display: grid;
  gap: 7px;
  color: #455067;
  font-size: 0.86rem;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 11px;
  outline: none;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.12);
}

.form-actions {
  margin-top: 16px;
}

.form-message {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 0.9rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.055em;
}

td {
  font-size: 0.93rem;
}

.strong {
  font-weight: 800;
}

.row-actions {
  display: flex;
  gap: 7px;
}

.small-button {
  padding: 7px 9px;
  background: #edf2f8;
  border-radius: 9px;
  font-size: 0.78rem;
}

.delete-button {
  color: var(--danger);
  background: var(--danger-soft);
}

.empty-state {
  padding: 36px 12px;
  color: var(--muted);
  text-align: center;
}

.report-footer {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
  padding: 16px;
  background: var(--surface-alt);
  border-radius: 14px;
}

.report-footer span,
.report-footer strong {
  display: block;
}

.report-footer span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.report-footer strong {
  font-size: 1.05rem;
}

.data-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.data-card p:last-child {
  margin-bottom: 0;
  max-width: 720px;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

dialog {
  width: min(520px, calc(100% - 24px));
  padding: 0;
  border: none;
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(10, 20, 45, 0.28);
}

dialog::backdrop {
  background: rgba(10, 17, 31, 0.54);
  backdrop-filter: blur(4px);
}

.dialog-card {
  display: grid;
  gap: 15px;
  padding: 24px;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 6px;
}

.dialog-header .icon-button {
  box-shadow: none;
}

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

  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .section-header.responsive,
  .data-card {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar > * {
    flex: 1 1 180px;
  }
}

@media (max-width: 620px) {
  .app-header,
  .container {
    width: min(100% - 20px, 1180px);
  }

  .app-header {
    padding-top: 22px;
  }

  .card {
    padding: 18px;
    border-radius: 16px;
  }

  .timer-info,
  .report-footer {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .wide {
    grid-column: auto;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    margin-bottom: 14px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 13px;
  }

  td {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 10px;
    padding: 7px 0;
    border: none;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
  }

  .row-actions {
    display: flex;
    padding-top: 12px;
  }

  .row-actions::before {
    display: none;
  }
}

@media print {
  body {
    background: white;
  }

  .app-header,
  .timer-card,
  .summary-grid,
  .entry-form,
  .data-card,
  .toolbar,
  .actions-column,
  .row-actions,
  .section-header .eyebrow {
    display: none !important;
  }

  .container {
    width: 100%;
    padding: 0;
  }

  .card {
    margin: 0;
    padding: 0;
    border: none;
    box-shadow: none;
  }

  .section-header {
    display: block !important;
  }

  .section-header h2::after {
    content: " – " attr(data-print-period);
  }

  table {
    display: table;
  }

  thead {
    display: table-header-group;
  }

  tbody {
    display: table-row-group;
  }

  tr {
    display: table-row;
  }

  th,
  td {
    display: table-cell;
    padding: 8px;
    border-bottom: 1px solid #ccc;
  }

  td::before {
    display: none;
  }

  .report-footer {
    display: grid;
    break-inside: avoid;
  }
}


.email-status {
  min-height: 22px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.email-status.success {
  color: var(--success);
}

.email-status.error {
  color: var(--danger);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}
