:root {
  --bg: #0f1310;
  --panel: #161d18;
  --panel-2: #1d261f;
  --border: rgba(218, 232, 214, 0.12);
  --text: #edf5eb;
  --muted: #9fad9b;
  --accent: #4caf50;
  --accent-2: #78d47d;
  --danger: #d95555;
  --warning: #d4aa4f;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 0%, rgba(76, 175, 80, 0.16), transparent 28%),
    radial-gradient(circle at 90% 8%, rgba(212, 170, 79, 0.12), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

button, input, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.topbar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.eyebrow {
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

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

h1 {
  font-size: clamp(28px, 3vw, 46px);
  line-height: 1.05;
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 22px;
}

.subtitle,
.panel-header p {
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.5;
}

.clock-card {
  min-width: 280px;
  background: linear-gradient(145deg, rgba(76, 175, 80, 0.13), rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.clock-label {
  color: var(--muted);
  font-size: 13px;
}

.clock-value {
  font-size: 28px;
  font-weight: 800;
  margin-top: 6px;
}

.summary-line {
  color: var(--accent-2);
  margin-top: 8px;
  font-size: 14px;
}

.grid-layout {
  display: grid;
  grid-template-columns: minmax(420px, 0.88fr) minmax(620px, 1.12fr);
  gap: 20px;
  align-items: start;
}

.panel {
  background: rgba(22, 29, 24, 0.94);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

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

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

.table-card {
  position: relative;
  min-height: 116px;
  background: linear-gradient(155deg, var(--panel-2), rgba(255, 255, 255, 0.025));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  color: var(--text);
  text-align: left;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.table-card:hover {
  transform: translateY(-2px);
  border-color: rgba(120, 212, 125, 0.4);
}

.table-card.active {
  border-color: rgba(212, 170, 79, 0.6);
  background: linear-gradient(155deg, rgba(212, 170, 79, 0.16), rgba(255, 255, 255, 0.035));
}

.table-card .name {
  font-size: 20px;
  font-weight: 800;
}

.table-card .rate {
  color: var(--muted);
  margin-top: 8px;
  font-size: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(76, 175, 80, 0.13);
  color: var(--accent-2);
  border: 1px solid rgba(76, 175, 80, 0.22);
  font-size: 12px;
  margin-top: 12px;
}

.badge.warning {
  background: rgba(212, 170, 79, 0.13);
  color: #f2cd76;
  border-color: rgba(212, 170, 79, 0.28);
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
}

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

th, td {
  padding: 12px 11px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.025);
}

td {
  color: var(--text);
}

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

.cost {
  color: var(--accent-2);
  font-weight: 800;
  white-space: nowrap;
}

.time {
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.comment-cell {
  max-width: 220px;
  color: var(--muted);
}

.primary-button,
.ghost-button,
.danger-button {
  min-height: 40px;
  border: 0;
  border-radius: 12px;
  padding: 0 14px;
  color: var(--text);
  font-weight: 700;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), #2e7d32);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
}

.danger-button {
  background: rgba(217, 85, 85, 0.14);
  border: 1px solid rgba(217, 85, 85, 0.36);
  color: #ffb2b2;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.history-panel {
  margin-top: 20px;
}

.history-header {
  align-items: center;
}

.download-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filters {
  display: grid;
  grid-template-columns: 1.6fr 180px 180px auto auto;
  gap: 10px;
  margin-bottom: 14px;
}

input, textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus, textarea:focus {
  border-color: rgba(120, 212, 125, 0.5);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  z-index: 100;
}

.modal {
  width: min(520px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.field-label {
  display: block;
  color: var(--muted);
  margin: 14px 0 8px;
  font-size: 13px;
  font-weight: 700;
}

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

.discount-option {
  min-height: 52px;
  border-radius: 14px;
  border: 1px solid var(--border);
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  text-align: left;
  padding: 10px 12px;
}

.discount-option.selected {
  border-color: rgba(120, 212, 125, 0.6);
  background: rgba(76, 175, 80, 0.14);
}

.discount-option strong {
  display: block;
}

.discount-option span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 420px;
  background: #202a22;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 15px;
  box-shadow: var(--shadow);
  z-index: 200;
}

.toast.error {
  border-color: rgba(217, 85, 85, 0.5);
}

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

@media (max-width: 1180px) {
  .topbar,
  .grid-layout {
    grid-template-columns: 1fr;
    display: grid;
  }

  .clock-card {
    min-width: 0;
  }

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

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 18px, 1560px);
    padding-top: 12px;
  }

  .panel {
    padding: 14px;
  }

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

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

  .panel-header,
  .history-header,
  .modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .download-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}
