* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, #eef6ff 0, #f8fbff 34%, #f5f7fb 60%),
    linear-gradient(180deg, #f8fbff 0, #f3f6fb 100%);
  color: #17212b;
  overflow-x: hidden;
}

a {
  color: inherit;
}

.app-shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 12px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 2px 2px 0;
}

.brand-link {
  display: inline-block;
  font-size: 1.45rem;
  font-weight: 800;
  color: #0c3559;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-sub {
  margin-top: 3px;
  font-size: 0.9rem;
  color: #5c6b7b;
}

.user-chip {
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid #d8e2ee;
  backdrop-filter: blur(10px);
  font-size: 0.92rem;
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.app-nav--desktop {
  display: flex;
}

.app-nav--mobile {
  display: none;
  margin: 10px 0 0;
}

.mobile-nav {
  display: none;
  margin-bottom: 12px;
  border: 1px solid #dbe4ee;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 26px rgba(16, 42, 67, 0.05);
  overflow: hidden;
}

.mobile-nav summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 700;
  color: #153d63;
  list-style: none;
}

.mobile-nav summary::-webkit-details-marker {
  display: none;
}

.mobile-nav summary::after {
  content: "▾";
  font-size: 0.9rem;
  color: #5a7391;
}

.mobile-nav[open] summary::after {
  content: "▴";
}

.nav-link,
.button,
button,
input,
select,
textarea {
  font: inherit;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease,
    transform 0.18s ease;
}

.nav-link,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid #d4dce6;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 20px rgba(16, 42, 67, 0.04);
  text-decoration: none;
}

.nav-link:hover,
.button:hover,
button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(16, 42, 67, 0.08);
}

.nav-link.is-active,
.button.is-primary,
button.is-primary {
  border-color: #2c74b4;
  background: #e9f4ff;
  color: #0e4f82;
}

.button.is-danger,
button.is-danger {
  border-color: #ebc1c1;
  background: #fff3f3;
  color: #8c2f2f;
}

.page-wrap {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.card {
  background: #ffffff;
  border: 1px solid #dbe4ee;
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 18px 38px rgba(16, 42, 67, 0.07);
  min-width: 0;
}

.hero-card {
  background: linear-gradient(135deg, #ffffff 0%, #f4f9ff 52%, #eaf3ff 100%);
  border-color: #cadef1;
}

.hero-card--dashboard {
  background: linear-gradient(135deg, #ffffff 0%, #f2f8ff 38%, #edf5ff 100%);
}

.hero-eyebrow {
  margin-bottom: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #4672a1;
}

.hero-actions {
  align-items: flex-start;
}

.card h1,
.card h2,
.card h3 {
  margin: 0 0 10px;
}

.muted {
  color: #5f6f80;
  font-size: 0.95rem;
  line-height: 1.45;
}

.flash {
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.96rem;
}

.flash--success {
  background: #e9f8ec;
  color: #1d6a2d;
  border: 1px solid #b8debf;
}

.flash--error {
  background: #fff1f1;
  color: #9c3131;
  border: 1px solid #edc3c3;
}

.flash--info {
  background: #eef5ff;
  color: #24517c;
  border: 1px solid #c8dcf1;
}

.auth-shell {
  max-width: 420px;
  margin: 4vh auto 0;
}

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

.compact-grid {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.form-span-all {
  grid-column: 1 / -1;
}

.form-grid.columns-2,
.summary-grid,
.list-grid {
  grid-template-columns: 1fr;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field.is-primary {
  padding: 12px;
  border-radius: 18px;
  background: linear-gradient(180deg, #f3f9ff 0%, #edf6ff 100%);
  border: 1px solid #c8def4;
}

.field.is-primary label {
  color: #0f4d82;
}

.field--compact input {
  text-align: center;
}

.field--date input {
  text-align: left;
}

.field--compact,
.field--compact input {
  min-width: 0;
}

.field--date input[type="date"],
.field--compact input[type="time"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.field--date input[type="date"]::-webkit-datetime-edit,
.field--compact input[type="time"]::-webkit-datetime-edit {
  padding: 0;
}

.field--date input[type="date"]::-webkit-datetime-edit-fields-wrapper,
.field--compact input[type="time"]::-webkit-datetime-edit-fields-wrapper {
  padding: 0;
  min-width: 0;
}

.field--date input[type="date"]::-webkit-date-and-time-value,
.field--compact input[type="time"]::-webkit-date-and-time-value {
  min-height: 1.15em;
}

label {
  font-size: 0.92rem;
  font-weight: 700;
}

input,
select,
textarea,
button {
  width: 100%;
  max-width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid #cad5e1;
  border-radius: 15px;
  background: #ffffff;
  color: #17212b;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #7aa7d2;
  box-shadow: 0 0 0 4px rgba(92, 152, 213, 0.14);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.inline-actions > * {
  width: auto;
}

.check-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: #314659;
}

.check-inline input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
}

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

.summary-box {
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #eef5ff 100%);
  border: 1px solid #d4e1ef;
}

.summary-box strong {
  display: block;
  font-size: 1.45rem;
  margin-bottom: 4px;
}

.sync-card {
  border-color: #d9e6f4;
}

.sync-card[data-state="info"] {
  background: linear-gradient(180deg, #fafdff 0%, #f0f7ff 100%);
}

.sync-card[data-state="warning"] {
  background: linear-gradient(180deg, #fffdf8 0%, #fff6e8 100%);
  border-color: #f0d8a6;
}

.sync-card[data-state="success"] {
  background: linear-gradient(180deg, #fbfffc 0%, #eefaf1 100%);
  border-color: #c6e5cd;
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.section-title--compact {
  margin-bottom: 12px;
}

.entry-list {
  display: grid;
  gap: 10px;
}

.entry-row {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #d7e0ea;
  border-radius: 16px;
  background: #fbfdff;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  max-width: 100%;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid #d4dce6;
  background: rgba(255, 255, 255, 0.92);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
  white-space: normal;
}

.pill.is-primary {
  background: #e9f4ff;
  border-color: #bfdaf5;
  color: #0f4d82;
}

.table-wrap {
  overflow: auto;
  border: 1px solid #d7e0ea;
  border-radius: 16px;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
  background: #ffffff;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid #e4ebf3;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f3f7fb;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #5f6f80;
}

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

.hint {
  margin-top: 6px;
  font-size: 0.84rem;
  color: #5f6f80;
  overflow-wrap: anywhere;
}

.profile-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.soft-panel {
  margin-top: 8px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid #d9e6f4;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f9ff 100%);
}

.turnstile-box {
  margin-top: 6px;
}

.upload-box {
  padding: 14px;
  border: 1px dashed #bfd1e4;
  border-radius: 16px;
  background: #f8fbff;
}

.suggest-box {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.suggest-box[hidden] {
  display: none;
}

.suggest-item {
  display: grid;
  gap: 3px;
  text-align: left;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid #cfe0f1;
  background: #ffffff;
}

.suggest-item strong {
  font-size: 0.95rem;
  color: #153d63;
  overflow-wrap: anywhere;
}

.suggest-item span,
.suggest-empty {
  font-size: 0.84rem;
  color: #5f6f80;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.desktop-only {
  display: block;
}

.mobile-only {
  display: none;
}

.suggest-empty {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px dashed #cfe0f1;
  background: #f8fbff;
}

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

.queue-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid #d7e0ea;
  background: rgba(255, 255, 255, 0.9);
}

.queue-item strong {
  display: block;
  margin-bottom: 4px;
  color: #163754;
}

.queue-remove {
  width: auto;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid #d6dde8;
  background: #ffffff;
  box-shadow: none;
  white-space: nowrap;
}

.edit-row-card {
  border: 1px solid #d7e0ea;
  border-radius: 16px;
  background: #fbfdff;
  padding: 12px 14px;
}

.edit-row-card summary {
  cursor: pointer;
  font-weight: 700;
  color: #17324a;
}

.edit-row-card[open] {
  background: #ffffff;
}

.preview-note {
  padding: 12px;
  border-radius: 14px;
  background: #fff8e7;
  border: 1px solid #f0d59a;
  color: #7a5a14;
}

@media (min-width: 720px) {
  .compact-grid--lead {
    grid-template-columns: minmax(180px, 0.8fr) minmax(0, 1.2fr);
  }

  .compact-grid--times {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

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

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

  .summary-grid.summary-grid--profile {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

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

@media (max-width: 719px) {
  .app-shell {
    max-width: 100%;
    padding: 4px;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
    padding: 2px 2px 0;
  }

  .user-chip {
    width: 100%;
    border-radius: 14px;
    padding: 8px 11px;
  }

  .app-nav--desktop {
    display: none;
  }

  .mobile-nav {
    display: block;
  }

  .mobile-nav[open] .app-nav--mobile {
    display: grid;
    grid-template-columns: 1fr;
  }

  .nav-link,
  .button,
  .inline-actions > * {
    width: 100%;
  }

  .card {
    padding: 10px;
    border-radius: 16px;
    box-shadow: 0 12px 26px rgba(16, 42, 67, 0.06);
  }

  .hero-card {
    padding: 12px;
  }

  .card h1 {
    font-size: 1.3rem;
  }

  .card h2 {
    font-size: 1.02rem;
  }

  .form-grid {
    gap: 10px;
  }

  .compact-grid {
    gap: 8px;
  }

  .compact-grid--lead {
    grid-template-columns: 1fr;
  }

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

  .page-wrap {
    gap: 10px;
  }

  .field.is-primary {
    padding: 10px;
    border-radius: 16px;
  }

  .field--compact {
    padding: 8px;
    border-radius: 14px;
  }

  .field--compact label {
    font-size: 0.84rem;
  }

  input,
  select,
  textarea,
  button {
    min-height: 42px;
    padding: 10px 11px;
    border-radius: 13px;
  }

  .soft-panel {
    padding: 10px;
    border-radius: 16px;
  }

  .field--compact input[type="date"],
  .field--compact input[type="time"] {
    min-height: 40px;
    padding: 8px 9px;
  }

  .field--date input[type="date"] {
    font-size: 0.94rem;
    letter-spacing: -0.02em;
  }

  .field--compact input[type="time"] {
    font-size: 0.88rem;
    letter-spacing: -0.01em;
    text-align: left;
  }

  .suggest-item,
  .suggest-empty,
  .upload-box,
  .summary-box,
  .entry-row,
  .queue-item {
    padding: 10px;
  }

  .queue-item {
    flex-direction: column;
  }

  .queue-remove {
    width: 100%;
  }

  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: block !important;
  }

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

  table {
    min-width: 560px;
  }
}
