:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --border: #d8dde6;
  --text: #142033;
  --muted: #5d6a80;
  --brand: #0059d6;
  --danger: #bf1d32;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Noto Sans", sans-serif;
  background: radial-gradient(circle at top left, #e2edff 0%, var(--bg) 45%, #ecf1ff 100%);
  color: var(--text);
}

.app-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

h1,
h2 {
  margin: 0;
}

h2 {
  margin-top: 18px;
  margin-bottom: 12px;
}

.muted {
  color: var(--muted);
  margin-top: 8px;
  margin-bottom: 0;
}

.status-chip {
  padding: 10px 14px;
  background: #e4eefc;
  border: 1px solid #b8d2fb;
  border-radius: 999px;
  font-weight: 600;
}

.tabs {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  margin-bottom: 16px;
}

.tab-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  padding: 8px 14px;
  cursor: pointer;
}

.tab-btn.active {
  border-color: var(--brand);
  color: var(--brand);
  font-weight: 700;
}

.tab-panel {
  display: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

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

.timer-card {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: linear-gradient(130deg, #f8fbff 0%, #eef4ff 100%);
}

.timer-main {
  flex: 1;
  min-width: 260px;
}

.timer-display {
  font-size: 48px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.timer-paused-meta {
  margin-top: 6px;
}

.daily-panel {
  width: min(420px, 100%);
  border: 1px solid #b9c7de;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
}

.daily-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 40px;
  min-width: 40px;
  padding: 8px 0;
  border-radius: 10px;
}

#dayInput {
  text-align: center;
  font-weight: 600;
}

.daily-total {
  margin-top: 10px;
  font-size: 38px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.day-paused-display {
  margin-top: 6px;
  margin-bottom: 0;
  font-weight: 600;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.grid-form label {
  display: block;
}

.grid-form span {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
}

.inline-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #2f5f9d;
}

.inline-feedback {
  margin-top: 8px;
  margin-bottom: 0;
  font-size: 13px;
  font-weight: 600;
}

.inline-feedback[data-kind="success"] {
  color: #1f7a43;
}

.inline-feedback[data-kind="error"] {
  color: var(--danger);
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}

.col-span-2 {
  grid-column: span 2;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  margin-bottom: 10px;
}

.manual-entry {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #f8fbff;
}

.manual-entry h3 {
  margin: 0;
  font-size: 18px;
}

button {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  background: #fff;
}

.icon-main-btn {
  width: 56px;
  min-width: 56px;
  height: 42px;
  padding: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button.primary {
  background: var(--brand);
  color: #fff;
  border-color: #004bb5;
}

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

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sessions-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sessions-toolbar .muted {
  margin: 0;
}

.sessions-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.session-select-cell {
  width: 44px;
}

.session-actions {
  width: 180px;
  text-align: center;
  white-space: nowrap;
}

.row-play-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  border-color: #95b6e8;
  background: #e9f2ff;
  color: #004bb5;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  margin-right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.row-play-btn:hover:not(:disabled) {
  background: #dbeaff;
  border-color: #6f9fe0;
}

.row-edit-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  border-color: #7abf9d;
  background: #e8f8ef;
  color: #1a7b4d;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  margin-right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.row-edit-btn:hover:not(:disabled) {
  background: #d8f2e3;
  border-color: #54a97f;
}

.row-delete-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  border-color: #dca0aa;
  background: #feecef;
  color: #ab1227;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.row-delete-btn:hover:not(:disabled) {
  background: #fbdde2;
  border-color: #cb7f8d;
}

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

.context-menu {
  position: fixed;
  z-index: 2000;
  min-width: 200px;
  border: 1px solid #bcc9dd;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 12px 26px rgba(14, 32, 62, 0.2);
  padding: 6px;
}

.context-menu button {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
}

.context-menu button:hover {
  background: #edf4ff;
  border-color: #c9daf8;
}

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

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid #e6ebf2;
}

th {
  font-size: 13px;
  color: var(--muted);
}

.list {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  background: #fafcff;
}

.list-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.result-box {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #f8fbff;
  min-height: 72px;
  white-space: pre-wrap;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(13, 24, 42, 0.46);
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-card {
  width: min(520px, 100%);
  border: 1px solid #bcc9dd;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 18px 44px rgba(12, 24, 44, 0.28);
  padding: 16px;
}

.rename-dialog h3 {
  margin: 0;
  font-size: 20px;
}

.rename-dialog .muted {
  margin-top: 8px;
  margin-bottom: 12px;
}

.rename-dialog-label {
  display: block;
}

.rename-dialog-label span {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
}

.modal-error {
  margin-top: 8px;
  margin-bottom: 0;
  color: var(--danger);
  font-size: 13px;
}

.summary-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.summary-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #f8fbff;
}

.summary-card h3 {
  margin-top: 0;
  margin-bottom: 10px;
}

.rename-dialog-actions {
  justify-content: flex-end;
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .timer-card {
    flex-direction: column;
  }

  .daily-panel {
    width: 100%;
  }

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

  .col-span-2 {
    grid-column: auto;
  }

  .timer-display {
    font-size: 38px;
  }

  .daily-total {
    font-size: 32px;
  }

  .sessions-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

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