:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --line: #d9dee7;
  --line-strong: #b7c0ce;
  --text: #1f2937;
  --muted: #667085;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #15803d;
  --red: #b91c1c;
  --amber: #c78100;
  --gray: #4b5563;
  --danger-bg: #fff1f2;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  min-height: 40px;
  padding: 10px 14px;
}

button:hover {
  background: var(--blue-dark);
}

button:disabled {
  background: #d4d9e2 !important;
  color: #747d8d !important;
  cursor: not-allowed;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 9px 10px;
}

input:focus,
select:focus {
  border-color: var(--blue);
  outline: 2px solid rgba(37, 99, 235, 0.15);
}

label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.page {
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

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

.topbar h1 {
  font-size: 24px;
  line-height: 1.2;
  margin: 0;
}

.topbar small {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-top: 3px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.grid {
  display: grid;
  gap: 14px;
}

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

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stack {
  display: grid;
  gap: 10px;
}

.row {
  align-items: end;
  display: flex;
  gap: 10px;
}

.row > * {
  flex: 1;
}

.row .auto {
  flex: 0 0 auto;
}

.form-grid {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}

.form-grid .wide {
  grid-column: span 2;
}

.form-grid .auto {
  justify-self: start;
}

.tabs {
  display: flex;
  gap: 6px;
  margin: 16px 0;
  overflow-x: auto;
}

.tab {
  background: #e8edf5;
  color: #243044;
  white-space: nowrap;
}

.tab.active {
  background: var(--text);
  color: #ffffff;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
}

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

table {
  border-collapse: collapse;
  min-width: 100%;
  width: max-content;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  background: #eef2f7;
  color: #344054;
  font-size: 12px;
  position: sticky;
  top: 0;
  z-index: 1;
}

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

.status {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 6px 9px;
}

.status.worked {
  background: #dcfce7;
  color: #166534;
}

.status.pending {
  background: #fef3c7;
  color: #92400e;
}

.status.off {
  background: #e0e7ff;
  color: #3730a3;
}

.status.missing {
  background: #f1f5f9;
  color: #475569;
}

.message {
  border-radius: 8px;
  display: none;
  font-weight: 700;
  margin-top: 10px;
  padding: 10px 12px;
}

.message.show {
  display: block;
}

.message.error {
  background: var(--danger-bg);
  color: var(--red);
}

.message.ok {
  background: #ecfdf3;
  color: var(--green);
}

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

.link-input {
  min-width: 360px;
}

.empty-cell {
  color: var(--muted);
  font-weight: 700;
  padding: 18px 12px;
  text-align: center;
}

.section-subtitle {
  font-size: 15px;
  margin: 0;
}

.balance-display {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  display: flex;
  font-weight: 800;
  min-height: 40px;
  padding: 9px 10px;
  white-space: nowrap;
}

.balance-display .muted {
  font-size: 12px;
  font-weight: 700;
  margin-left: 8px;
}

.secondary {
  background: #e8edf5;
  color: #243044;
}

.secondary:hover {
  background: #dce3ee;
}

.danger {
  background: var(--red);
}

.danger:hover {
  background: #991b1b;
}

.green {
  background: var(--green);
}

.green:hover {
  background: #166534;
}

.amber {
  background: var(--amber);
  color: #1f2937;
}

.amber:hover {
  background: #a76400;
  color: #ffffff;
}

.login-shell,
.punch-shell {
  min-height: 100vh;
  padding: 18px;
}

.login-panel,
.punch-panel {
  margin: 0 auto;
  max-width: 430px;
}

.punch-panel {
  position: relative;
}

.punch-title {
  color: var(--blue);
  font-size: 22px;
  margin: 0 0 14px;
  text-align: center;
}

.punch-info {
  margin-bottom: 12px;
}

.punch-status {
  background: #e8f0fe;
  border-radius: 8px;
  line-height: 1.5;
  margin: 12px 0;
  padding: 12px 14px;
}

.punch-actions {
  display: grid;
  gap: 8px;
}

.punch-actions button {
  min-height: 48px;
}

#CHECK_OUT {
  background: var(--red);
}

#BREAK_START {
  background: var(--amber);
  color: #202124;
}

#BREAK_END {
  background: var(--green);
}

#DAY_OFF {
  background: var(--gray);
}

.work-place-box {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: none;
  margin: 10px 0;
  padding: 12px;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  margin-top: 6px;
}

.required-empty {
  background: #fff1f2;
  border-color: var(--red);
}

.logs {
  border-top: 1px solid var(--line);
  color: #3c4043;
  font-size: 14px;
  line-height: 1.6;
  margin-top: 18px;
  padding-top: 14px;
}

.loading-overlay {
  align-items: center;
  background: rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  bottom: 0;
  color: var(--blue);
  display: none;
  font-weight: 800;
  justify-content: center;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 10;
}

@media (max-width: 760px) {
  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }

  .row {
    align-items: stretch;
    flex-direction: column;
  }

  .row .auto {
    flex: 1;
  }

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

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

  .form-grid .auto {
    justify-self: stretch;
  }

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

  .link-input {
    min-width: 260px;
  }
}
