:root {
  --bg: #f2f4f7;
  --bg-elevated: #ffffff;
  --ink: #1a2332;
  --muted: #5c6b7a;
  --line: #d8dee6;
  --accent: #0d6e6e;
  --accent-hover: #0a5555;
  --accent-soft: #e6f3f3;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --ok: #067647;
  --shadow: 0 1px 2px rgba(26, 35, 50, 0.06), 0 8px 24px rgba(26, 35, 50, 0.06);
  --radius: 14px;
  --font: "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 10% -10%, #d9ecec 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #e8eef5 0%, transparent 50%),
    var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font: inherit;
}

a {
  color: var(--accent);
}

.app-shell {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 0 16px calc(88px + var(--safe-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
}

.brand {
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.brand span {
  color: var(--accent);
}

.user-chip {
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

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

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

.field textarea {
  min-height: 84px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, white);
  border-color: var(--accent);
}

.hours-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 0.95rem;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 11px;
  padding: 12px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn:hover {
  background: var(--accent-hover);
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-secondary:hover {
  background: #f7f9fb;
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #fecdca;
}

.btn-block {
  width: 100%;
}

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

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px 10px calc(8px + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.92);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.nav button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
  padding: 8px 4px;
  border-radius: 10px;
  cursor: pointer;
}

.nav button.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.login-card {
  width: min(420px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px 22px;
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 1.6rem;
  letter-spacing: -0.03em;
}

.login-card .sub {
  margin: 0 0 22px;
  color: var(--muted);
}

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.entry {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.entry-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.entry-date {
  font-weight: 700;
}

.entry-hours {
  color: var(--accent);
  font-weight: 700;
}

.entry-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

.entry-desc {
  margin-top: 6px;
  font-size: 0.92rem;
}

.entry-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.entry-actions button {
  flex: 1;
  padding: 8px 10px;
  font-size: 0.85rem;
}

.stat-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

.stat-row:last-child {
  border-bottom: none;
}

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

.error {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #fecdca;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.ok-msg {
  background: #ecfdf3;
  color: var(--ok);
  border: 1px solid #abeFC6;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.month-nav strong {
  font-size: 1.05rem;
}

.hidden {
  display: none !important;
}

.admin-section {
  margin-top: 8px;
}

.inline-form {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.chip-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chip-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbfc;
}

.chip-item span {
  font-size: 0.9rem;
}

.small {
  font-size: 0.8rem;
}

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

  .nav {
    max-width: 720px;
    margin: 0 auto;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 16px 16px 0 0;
  }
}
