:root {
  --bg: #ffffff;
  --card: #ffffff;
  --card-border: #e5e5e8;
  --text: #111114;
  --text-soft: #333338;
  --text-muted: #7e7e88;
  --input-bg: #fafafa;
  --input-border: #d0d0d6;
  --border-focus: #111114;
  --divider: #e0e0e4;
  --bar-border: #ebebee;
  --tab-inactive: #f0ede8;
  --trust-icon: #5c5c66;
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Nunito', sans-serif;
}

.thin-bar {
  border-bottom: 1px solid var(--bar-border);
  padding: 8px 24px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.thin-bar a {
  color: var(--text-soft);
  text-decoration: none;
  font-weight: 600;
}
.thin-bar a:hover { text-decoration: underline; color: var(--text); }
.thin-bar .dot { color: var(--divider); }

.container {
  max-width: 520px; margin: 0 auto;
  padding: 36px 24px 20px;
}

.header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.brand-name {
  font-family: 'DM Serif Display', serif;
  font-size: 18px; color: var(--text);
  text-decoration: none;
}
.header-subtitle {
  font-size: 13px; color: var(--text-muted); font-weight: 600;
}

.card {
  background: var(--card);
  border: 1.5px solid var(--card-border);
  border-radius: 18px; padding: 32px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

.field { margin-bottom: 22px; }

label {
  display: block; font-size: 13px; font-weight: 700;
  color: var(--text); margin-bottom: 8px;
}

input[type="text"], input[type="email"], input[type="password"], textarea, input[type="date"], input[type="time"] {
  width: 100%; background: var(--input-bg);
  border: 1.5px solid var(--input-border); border-radius: 10px;
  color: var(--text); font-family: 'Nunito', sans-serif;
  font-size: 15px; padding: 13px 16px;
  outline: none; transition: all 0.2s;
}
input:focus, textarea:focus {
  border-color: var(--text); background: white;
  box-shadow: 0 0 0 3px rgba(17,17,20,0.05);
}
textarea { resize: vertical; min-height: 6em; }
input::placeholder, textarea::placeholder { color: #a8a8b2; }

.submit-btn {
  width: 100%; background: #2D7DD2;
  border: none; border-radius: 10px; color: white;
  font-family: 'Nunito', sans-serif; font-size: 16px; font-weight: 700;
  padding: 16px; cursor: pointer; transition: all 0.3s;
  box-shadow: 0 4px 16px rgba(17,17,20,0.15); margin-top: 4px;
}
.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(17,17,20,0.2);
}

.flash {
  padding: 12px 16px; border-radius: 10px; margin-bottom: 20px;
  font-size: 14px; font-weight: 600;
}
.flash-success { background: #e8f5e9; color: #2e7d32; }
.flash-error { background: #fce4ec; color: #c62828; }
.flash-warning { background: #fff3e0; color: #e65100; }

.footer {
  text-align: center; margin-top: 15px;
  font-size: 13px; color: var(--text-muted);
}
.footer a { color: var(--text-soft); text-decoration: none; font-weight: 600; }
.footer a:hover { color: var(--text); text-decoration: underline; }
.footer .dot { color: var(--divider); margin: 0 2px; }

.logged-in-info {
  text-align: center;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-muted);
}

.show-mobile { display: none; }

/* ---- Homepage overrides ---- */
.page-home .container { padding: 20px 24px 20px; }
.page-home .header { margin-bottom: 20px; }
.page-home .card { padding: 28px; }
.page-home label { font-size: 15px; margin-bottom: 12px; }
.page-home input[type="text"],
.page-home input[type="email"],
.page-home input[type="password"],
.page-home textarea,
.page-home input[type="date"],
.page-home input[type="time"] {
  margin-bottom: 5px;
}

/* ---- Tabbed date picker ---- */
.when-tabs {
  border: 1.5px solid var(--input-border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--input-bg);
}

.when-tabs-header {
  display: flex;
  border-bottom: 1.5px solid var(--input-border);
  background: var(--tab-inactive);
}

.when-tab-btn {
  flex: 1;
  padding: 11px 6px;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
  position: relative;
}
.when-tab-btn:not(:last-child) {
  border-right: 1.5px solid var(--input-border);
}
.when-tab-btn:hover {
  color: var(--text-soft);
}
.when-tab-btn.active {
  background: var(--card);
  color: var(--text);
}
.when-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1.5px;
  left: 0; right: 0;
  height: 2px;
  background: #2D7DD2;
}

.when-tab-panel {
  display: none;
  padding: 16px;
  background: var(--input-bg);
}
.when-tab-panel input[type="text"],
.when-tab-panel input[type="date"],
.when-tab-panel input[type="time"] {
  background: white;
}
.when-tab-panel.active {
  display: block;
}

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

.pill {
  background: white; border: 1.5px solid var(--input-border);
  border-radius: 100px;
  color: var(--text-soft); font-family: 'Nunito', sans-serif;
  font-size: 13px; font-weight: 700; padding: 6px 10px;
  cursor: pointer; transition: all 0.2s;
}
.pill:hover {
  border-color: var(--text-soft); background: white;
  color: var(--text); transform: translateY(-1px);
}
.pill.active {
  background: #2D7DD2; border-color: #2D7DD2; color: white;
  box-shadow: 0 3px 10px rgba(45,125,210,0.25); transform: translateY(-1px);
}

.resolved-date {
  display: none;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.resolved-date.visible {
  display: flex;
}
.resolved-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #3ea853;
  flex-shrink: 0;
}
.resolved-edit {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px dashed var(--input-border);
  transition: all 0.15s;
}
.resolved-edit:hover {
  color: #2D7DD2;
  border-color: #2D7DD2;
}
.resolved-hint {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.past-date-error {
  display: none;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
  color: #c62828;
}
.past-date-error.visible {
  display: block;
}

.date-row { display: flex; gap: 10px; position: relative; }
.date-row input { flex: 1; }

/* iOS date/time placeholder overlay */
.date-row .ios-ph {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #a8a8b2;
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  pointer-events: none;
}

.format-help-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: #e8e8e8; color: #a4a4a4;
  font-size: 11px; font-weight: 700; line-height: 1;
  margin-left: 4px; vertical-align: middle; cursor: pointer;
  transition: all 0.15s;
}
.format-help-toggle:hover {
  background: var(--text-muted); color: white;
}
.format-help {
  display: none;
  background: var(--card);
  border: 1.5px solid var(--input-border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 10px;
  margin-bottom: 2px;
}
.format-help.visible { display: block; }
.format-help-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-bottom: 8px;
}
.format-help-row:last-child { margin-bottom: 0; }
.format-help-label {
  font-size: 13px; font-weight: 700; color: var(--text-soft);
  min-width: 64px;
}
.format-help code {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  padding: 2px 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 12px; font-weight: 600;
  color: var(--text-soft);
}

/* ---- Mobile ---- */
@media screen and (max-width: 768px) {
  input[type="text"], input[type="email"], input[type="password"], textarea, input[type="date"], input[type="time"], select {
    font-size: 16px;
  }
  textarea {
    padding-top: 8px;
    padding-bottom: 6px;
    min-height: 7em;
  }
  .container,
  .page-home .container {
    padding: 16px 16px 16px;
  }
  .card,
  .page-home .card {
    border: none;
    border-top: 1px solid var(--card-border);
    border-bottom: 1px solid var(--card-border);
    border-radius: 0;
    padding: 18px 0;
    box-shadow: none;
  }
  .header,
  .page-home .header {
    margin-bottom: 14px;
  }
  label {
    margin-bottom: 6px;
  }
  .page-home label {
    margin-bottom: 6px;
  }
  .page-home input[type="text"],
  .page-home input[type="email"],
  .page-home input[type="password"],
  .page-home textarea,
  .page-home input[type="date"],
  .page-home input[type="time"] {
    margin-bottom: 0;
  }
  .hide-mobile { display: none; }
  .show-mobile { display: inline; }
  .when-tab-panel {
    padding: 12px;
  }
  #tab-custom input[name="custom_time"] {
    padding-left: 12px;
    padding-right: 8px;
  }
  .format-help-label {
    width: 100%;
    margin-bottom: 0;
  }
  .pill {
    font-size: 13px; font-weight: 700; padding: 6px 14px;
  }
  .date-row .ios-ph { font-size: 16px; }
}