:root {
  color-scheme: light;
  --bg: #f5f1e8;
  --panel: #ffffff;
  --ink: #1f2a24;
  --muted: #66736b;
  --line: #d9d7cd;
  --green: #2f5f4a;
  --green-dark: #234839;
  --gold: #d4a23f;
  --red: #b84d3a;
  --shadow: 0 18px 45px rgba(31, 42, 36, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(47, 95, 74, 0.16), transparent 280px),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(100%, 620px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 18px 36px;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.brand-mark {
  display: grid;
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 2px solid rgba(47, 95, 74, 0.28);
  border-radius: 8px;
  background: #fffaf0;
  color: var(--green-dark);
  font-weight: 800;
  text-decoration: none;
}

.eyebrow,
.status-label,
.employee-email,
.last-event,
.sync-message,
.item-meta {
  margin: 0;
  color: var(--muted);
}

.eyebrow,
.status-label,
.field-label {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.65rem, 8vw, 2.35rem);
  line-height: 1;
}

h2 {
  font-size: 1.22rem;
  line-height: 1.18;
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.mode-tab {
  display: grid;
  min-height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--green-dark);
  font-weight: 800;
  text-decoration: none;
}

.mode-tab.active {
  background: var(--green);
  color: white;
}

.panel,
.clock-panel,
.history-panel,
.employee-bar,
.admin-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.tracker,
.view-stack,
.admin-view {
  display: grid;
  gap: 14px;
}

.employee-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
}

.employee-name {
  margin: 0 0 3px;
  font-weight: 800;
}

.employee-email {
  max-width: 340px;
  overflow: hidden;
  font-size: 0.88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button,
.icon-button,
.clock-button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.button-primary,
.clock-button {
  background: var(--green);
  color: white;
}

.button-secondary {
  display: grid;
  place-items: center;
  background: #f0eee5;
  color: var(--green-dark);
  text-decoration: none;
}

.button-primary:hover,
.clock-button:hover {
  background: var(--green-dark);
}

.button-danger {
  background: #f7e7e2;
  color: #8d3526;
}

.icon-button {
  min-width: 86px;
  padding: 0 12px;
  background: #f0eee5;
  color: var(--green-dark);
}

.clock-panel,
.admin-section {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.clock-button {
  width: 100%;
  min-height: 86px;
  margin-top: 4px;
  font-size: 1.45rem;
}

.clock-button.clock-out {
  background: var(--red);
}

.clock-button:disabled,
.button:disabled,
.icon-button:disabled,
.field-control:disabled {
  cursor: wait;
  opacity: 0.65;
}

.field-label {
  display: block;
  color: var(--muted);
}

.field-control {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
  color: var(--ink);
  padding: 0 12px;
}

.text-area {
  min-height: 96px;
  padding: 12px;
  resize: vertical;
}

.field-control:focus {
  border-color: var(--green);
  outline: 3px solid rgba(47, 95, 74, 0.16);
}

.history-panel {
  padding: 18px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.section-heading h2 {
  font-size: 1rem;
}

.badge {
  border-radius: 999px;
  background: #fff2d5;
  color: #75500c;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 5px 9px;
}

.event-list,
.admin-list {
  display: grid;
  gap: 10px;
  min-height: 48px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.event-item,
.admin-item {
  display: grid;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.event-item {
  grid-template-columns: auto 1fr auto;
  align-items: center;
}

.event-item:first-child,
.admin-item:first-child {
  border-top: 0;
}

.event-type {
  min-width: 42px;
  border-radius: 8px;
  background: #e8f1ec;
  color: var(--green-dark);
  font-size: 0.76rem;
  font-weight: 900;
  padding: 7px 8px;
  text-align: center;
}

.event-type.out {
  background: #f7e7e2;
  color: #8d3526;
}

.event-time,
.item-title {
  margin: 0;
  font-weight: 800;
}

.sync-issue-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.sync-error {
  overflow-wrap: anywhere;
}

.event-date,
.event-sync {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.event-sync {
  text-align: right;
}

.admin-form {
  display: grid;
  gap: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stacked-field {
  display: grid;
  gap: 6px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  color: var(--muted);
  font-weight: 700;
}

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

.link-button {
  display: grid;
  place-items: center;
  text-decoration: none;
}

.note-dialog {
  width: min(92vw, 460px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.note-dialog::backdrop {
  background: rgba(31, 42, 36, 0.42);
}

.dialog-card {
  display: grid;
  gap: 14px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
}

.dialog-actions {
  justify-content: flex-end;
}

.segmented-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  width: 100%;
}

.segmented-button {
  display: grid;
  width: 100%;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 0;
  padding: 0;
}

.lunch-dialog {
  width: min(92vw, 460px);
}

.lunch-dialog-card {
  width: 100%;
}

.lunch-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.lunch-actions .segmented-button {
  width: 100%;
  height: 48px;
}

@media (max-width: 540px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .sync-issue-item {
    grid-template-columns: 1fr;
  }
}

[hidden] {
  display: none !important;
}

@media (min-width: 720px) {
  .app-shell {
    padding-top: 46px;
  }
}
