:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --soft: #f8fafc;
  --text: #18202a;
  --muted: #6b7280;
  --line: #d8dee8;
  --primary: #126f67;
  --primary-dark: #0b554f;
  --danger: #b42318;
  --success: #167245;
  --warning: #a05a00;
  --radius: 8px;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.shell { width: min(1180px, calc(100% - 28px)); margin: 0 auto; padding: 18px 0 34px; }
.topbar, .panel, .message, .metrics > div, .table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.topbar {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  box-shadow: 0 14px 32px rgba(24, 32, 42, 0.08);
}
h1, h2, p { margin: 0; }
h1 { font-size: 25px; }
h2 { font-size: 18px; margin-bottom: 12px; }
.topbar p, .clock span, .work-grid span, .metrics span, .muted { color: var(--muted); }
.clock { min-width: 178px; min-height: 58px; display: grid; place-items: center; background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius); }
.clock strong { font-size: 20px; }
.clock span { font-size: 13px; }

.tabs { display: flex; gap: 8px; margin: 16px 0; border-bottom: 1px solid var(--line); }
.tab { min-height: 44px; border: 0; background: transparent; color: var(--muted); padding: 0 16px; border-bottom: 3px solid transparent; }
.tab.active { color: var(--primary); border-color: var(--primary); font-weight: 700; }
.view { display: none; }
.view.active { display: block; }
.hidden { display: none !important; }

.work-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.work-grid > div { min-height: 78px; display: grid; align-content: center; gap: 4px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.work-grid strong { font-size: 20px; }

.panel { padding: 16px; }
label { display: grid; gap: 8px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
  outline: none;
}
textarea { min-height: 104px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(18, 111, 103, 0.14); }

.action-grid, .admin-grid, .metrics, .settings-grid, .filters { display: grid; gap: 10px; }
.action-grid { grid-template-columns: repeat(2, 1fr); margin-top: 14px; }
.admin-grid { grid-template-columns: minmax(0, 1.15fr) minmax(310px, 0.85fr); margin-bottom: 12px; }
.settings-grid { grid-template-columns: repeat(3, 1fr); }
.metrics { grid-template-columns: repeat(4, 1fr); margin-bottom: 12px; }
.metrics > div { min-height: 82px; padding: 14px 16px; display: grid; align-content: center; gap: 4px; }
.metrics strong { font-size: 28px; }
.filters { grid-template-columns: 170px minmax(180px, 1fr) 170px 96px 96px; align-items: end; margin-bottom: 12px; }

.primary, .secondary, .save-btn {
  min-height: 46px;
  border-radius: 8px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  padding: 0 16px;
}
.primary { background: var(--primary); color: #fff; }
.primary:hover { background: var(--primary-dark); }
.secondary { background: #fff; color: var(--text); border-color: var(--line); }
.secondary:hover { color: var(--primary); border-color: var(--primary); }
.compact { min-height: 42px; }
.save-btn { width: 78px; min-height: 38px; background: #102d2b; color: #fff; }

.message { min-height: 82px; margin-top: 14px; padding: 15px 17px; display: grid; gap: 5px; }
.message span { color: var(--muted); }
.message.success { background: #eaf7ef; border-color: #a9d9bd; }
.message.warning { background: #fff5e5; border-color: #efcb8d; }
.message.danger { background: #fff1f0; border-color: #f1aaa3; }

.login-panel { max-width: 460px; }
.login-row, .employee-row { display: grid; grid-template-columns: minmax(0, 1fr) 100px; gap: 8px; }
.checkbox { min-height: 44px; display: flex; align-items: center; gap: 8px; margin: 12px 0; }
.checkbox input { width: 18px; min-height: 18px; accent-color: var(--primary); }
.status-line, .error-line { min-height: 22px; margin-top: 8px; color: var(--danger); }
.employees-list { display: grid; gap: 8px; margin-top: 12px; }
.employee-item { min-height: 42px; display: grid; grid-template-columns: minmax(0, 1fr) 88px; gap: 8px; align-items: center; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.employee-item strong { overflow-wrap: anywhere; }
.employee-item button { min-height: 32px; border: 1px solid #f1aaa3; border-radius: 8px; background: #fff1f0; color: var(--danger); font-weight: 700; }

.table-wrap { overflow: auto; }
table { width: 100%; min-width: 1020px; border-collapse: collapse; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
thead th { background: var(--soft); font-size: 13px; color: #344052; position: sticky; top: 0; }
td input, td select { margin-top: 6px; }
.pill { display: inline-flex; min-height: 28px; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.pill.early { background: #eaf7ef; color: var(--success); }
.pill.grace { background: #fff2df; color: var(--warning); }
.pill.late { background: #fff1f0; color: var(--danger); }
.empty { min-height: 88px; display: grid; place-items: center; color: var(--muted); }

@media (max-width: 820px) {
  .shell { width: min(100% - 20px, 1180px); padding-top: 10px; }
  .topbar, .work-grid, .action-grid, .admin-grid, .settings-grid, .metrics, .filters, .login-row, .employee-row {
    grid-template-columns: 1fr;
  }
  .topbar { display: grid; }
  h1 { font-size: 21px; }
  .tabs { overflow-x: auto; }
  .tab { white-space: nowrap; }
}
