:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --primary: #0f766e;
  --primary-weak: #dff5f2;
  --text: #0f172a;
  --muted: #64748b;
  --border: #d8e0ea;
}

html {
  width: 100%;
  overflow-x: hidden;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--text);
  overflow-x: hidden;
  background:
    radial-gradient(circle at 90% -20%, #cce8ff 0, transparent 35%),
    radial-gradient(circle at -10% 20%, #e8f8ef 0, transparent 32%),
    var(--bg);
}

.container {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.05);
  min-width: 0;
}

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

.control-row {
  display: grid;
  gap: 8px;
}

.control-row.compact {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-row.inline {
  grid-template-columns: auto 120px;
  align-items: center;
  justify-content: start;
  column-gap: 12px;
}

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

label {
  font-weight: 600;
  color: #1e293b;
}

input[type="file"],
input[type="time"],
input[type="number"],
select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
}

input[type="number"] {
  width: 84px;
}

.control-row.inline select {
  min-width: 90px;
}

.unit {
  font-size: 12px;
  color: #64748b;
}

button {
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  padding: 7px 12px;
  cursor: pointer;
  font-weight: 600;
}

button:hover:not(:disabled) {
  filter: brightness(1.06);
}

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

.actions button:not(:first-child) {
  background: #0f172a;
}

.status {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  margin-left: auto;
}

.controls .status {
  min-width: 220px;
  text-align: right;
}

.table-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior-x: contain;
  border: 1px solid var(--border);
  border-radius: 10px;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 720px;
  background: #fff;
}

th,
td {
  padding: 7px 8px;
  border-bottom: 1px solid #e8edf4;
  text-align: left;
  font-size: 13px;
}

th {
  background: #f8fbff;
  position: sticky;
  top: 0;
  z-index: 1;
}

tr:hover td {
  background: #f8fffd;
}

#matrixTable {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

#matrixTable th,
#matrixTable td {
  text-align: center;
  white-space: nowrap;
}

#matrixTable .sticky-col {
  position: sticky;
  left: 0;
  text-align: left;
  min-width: 160px;
  max-width: 220px;
  background: #f5f9ff;
  z-index: 6;
  box-shadow: 2px 0 0 #dbe4f0;
}

#matrixTable td.total,
#matrixTable th:last-child {
  background: #ecfdf5;
  font-weight: 700;
}

#matrixTable td.punch {
  color: #334155;
  font-size: 12px;
}

#matrixTable td.empty-total {
  color: #94a3b8;
}

#matrixTable td.label {
  font-weight: 600;
}

#matrixTable tr.person-punch-row td {
  background: #fafcff;
}

#matrixTable tr.person-minute-row td {
  background: #f8fafc;
}

#matrixTable tr.person-overtime-row td {
  border-bottom: 2px solid #dbe7f5;
}

#matrixTable tr.person-punch-row td.sticky-col,
#matrixTable tr.person-minute-row td.sticky-col,
#matrixTable tr.person-overtime-row td.sticky-col {
  background: #f5f9ff;
}

#matrixTable td.num {
  font-variant-numeric: tabular-nums;
}

#matrixTable td.minute {
  color: #0f172a;
  font-weight: 600;
}

#matrixTable td.minute-total {
  background: #dcfce7;
}

.panel h2 {
  margin: 0;
}

@media (max-width: 820px) {
  .controls {
    display: grid;
    gap: 10px;
  }

  .control-row.compact {
    display: grid;
    gap: 8px;
  }

  .control-row.inline {
    grid-template-columns: 1fr;
  }

  .controls .status {
    min-width: 0;
    text-align: left;
    margin-left: 0;
  }
}
