/* Notion-style page: cover, icon, big title, property rows, callouts. */

:root {
  --bg: #ffffff;
  --text: rgb(55, 53, 47);
  --muted: rgba(55, 53, 47, 0.65);
  --faint: rgba(55, 53, 47, 0.45);
  --divider: rgba(55, 53, 47, 0.09);
  --hover: rgba(55, 53, 47, 0.06);
  --input-bg: rgba(242, 241, 238, 0.6);
  --input-ring: rgba(15, 15, 15, 0.1);
  --callout: rgb(241, 241, 239);
  --green-bg: rgb(237, 243, 236);
  --yellow-bg: rgb(251, 243, 219);
  --red-bg: rgb(253, 235, 236);
  --red: rgb(212, 76, 71);
  --tag-green-bg: rgb(219, 237, 219);
  --tag-green-text: rgb(28, 56, 41);
  --tag-yellow-bg: rgb(253, 236, 200);
  --tag-yellow-text: rgb(64, 44, 27);
  --blue: rgb(35, 131, 226);
  --blue-hover: rgb(0, 119, 212);
  --focus: rgba(35, 131, 226, 0.57);
  --focus-soft: rgba(35, 131, 226, 0.35);
  --btn-ring: rgba(15, 15, 15, 0.16);
  --code-bg: rgba(135, 131, 120, 0.15);
  --code-text: rgb(235, 87, 87);
  --cover-fade: rgba(255, 255, 255, 0);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: rgb(25, 25, 25);
    --text: rgba(255, 255, 255, 0.81);
    --muted: rgba(255, 255, 255, 0.5);
    --faint: rgba(255, 255, 255, 0.32);
    --divider: rgba(255, 255, 255, 0.094);
    --hover: rgba(255, 255, 255, 0.055);
    --input-bg: rgba(255, 255, 255, 0.055);
    --input-ring: rgba(255, 255, 255, 0.094);
    --callout: rgb(37, 37, 37);
    --green-bg: rgb(36, 61, 48);
    --yellow-bg: rgb(64, 53, 36);
    --red-bg: rgb(82, 46, 42);
    --red: rgb(230, 91, 80);
    --tag-green-bg: rgb(43, 89, 63);
    --tag-green-text: rgba(255, 255, 255, 0.88);
    --tag-yellow-bg: rgb(137, 99, 42);
    --tag-yellow-text: rgba(255, 255, 255, 0.88);
    --btn-ring: rgba(255, 255, 255, 0.13);
    --code-bg: rgba(135, 131, 120, 0.15);
    --code-text: rgb(255, 115, 105);
    --cover-fade: rgba(25, 25, 25, 0);
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Helvetica,
    "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-underline-offset: 2px;
}
a:hover {
  text-decoration-color: var(--text);
}

hr {
  border: 0;
  border-top: 1px solid var(--divider);
  margin: 28px 0 16px;
}

code {
  font-family: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.85em;
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 4px;
  padding: 0.2em 0.4em;
  word-break: break-all;
}

/* ---- Cover + page ---- */

.cover {
  height: 30vh;
  max-height: 240px;
  min-height: 140px;
  background: url("/cover.jpg") center 40% / cover no-repeat, rgb(232, 226, 210);
}

.page {
  width: 100%;
  max-width: 708px;
  margin: 0 auto;
  padding: 0 24px 64px;
}
.page-wide {
  max-width: 1120px;
}

.page-icon-link {
  display: inline-block;
  margin-top: -64px;
  border-radius: 50%;
}
.page-icon {
  display: block;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: 0 0 0 4px var(--bg);
}

.title {
  font-size: 40px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 24px 0 4px;
}

.lede {
  color: var(--muted);
  font-size: 18px;
  margin: 0 0 20px;
}

.h2 {
  font-size: 1.5em;
  font-weight: 600;
  line-height: 1.3;
  margin: 32px 0 12px;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 14px;
}

.footer {
  margin-top: 56px;
  color: var(--faint);
  font-size: 13px;
}

/* ---- Properties (Notion database-style rows) ---- */

.props {
  margin: 12px 0 20px;
}

.prop {
  display: flex;
  align-items: flex-start;
  min-height: 34px;
  padding: 2px 0;
}

.prop-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 160px;
  min-height: 30px;
  color: var(--muted);
  font-size: 14px;
  padding: 0 6px;
}

.prop-value {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 30px;
  padding: 4px 8px;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.icon {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--faint);
}

/* ---- Callouts ---- */

.callout {
  display: flex;
  gap: 10px;
  padding: 16px 16px 16px 12px;
  margin: 16px 0;
  border-radius: 6px;
  background: var(--callout);
  font-size: 15px;
}
.callout-icon {
  font-size: 20px;
  line-height: 1.2;
  width: 24px;
  text-align: center;
  flex: none;
}
.callout-green {
  background: var(--green-bg);
}
.callout-yellow {
  background: var(--yellow-bg);
}
.callout-red {
  background: var(--red-bg);
}

/* ---- Form ---- */

.form {
  margin: 0;
}

.field {
  display: flex;
  align-items: flex-start;
  padding: 4px 0;
}

.field > label {
  flex: 0 0 160px;
  padding: 7px 6px;
  font-size: 14px;
  color: var(--muted);
}

.optional {
  display: block;
  font-size: 12px;
  color: var(--faint);
}

.control {
  flex: 1 1 auto;
  min-width: 0;
}

input[type="text"],
input[type="tel"],
input[type="search"],
input[type="email"],
input[type="password"] {
  width: 100%;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--input-bg);
  border: 0;
  border-radius: 6px;
  box-shadow: var(--input-ring) 0 0 0 1px inset;
  padding: 8px 10px;
  line-height: 20px;
  outline: none;
  transition: box-shadow 120ms ease;
  -webkit-appearance: none;
  appearance: none;
}
input::placeholder {
  color: var(--faint);
}
input:focus {
  box-shadow: var(--focus) 0 0 0 1px inset, var(--focus-soft) 0 0 0 2px;
}
input[aria-invalid="true"] {
  box-shadow: var(--red) 0 0 0 1px inset;
}

.input-group {
  display: flex;
  align-items: stretch;
  border-radius: 6px;
  background: var(--input-bg);
  box-shadow: var(--input-ring) 0 0 0 1px inset;
  transition: box-shadow 120ms ease;
}
.input-group:focus-within {
  box-shadow: var(--focus) 0 0 0 1px inset, var(--focus-soft) 0 0 0 2px;
}
.input-group:has(input[aria-invalid="true"]) {
  box-shadow: var(--red) 0 0 0 1px inset;
}
.input-group .prefix {
  display: flex;
  align-items: center;
  padding: 0 4px 0 10px;
  color: var(--muted);
  font-size: 15px;
}
.input-group input,
.input-group input:focus {
  background: transparent;
  box-shadow: none;
  padding-left: 6px;
}

.error {
  display: none;
  margin: 4px 2px 0;
  font-size: 13px;
  color: var(--red);
}
.error.visible {
  display: block;
}

.submit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 20px 0 0 160px;
}

.fine {
  margin: 0;
  font-size: 13px;
  color: var(--faint);
}

.form-status {
  min-height: 22px;
  margin: 12px 0 0 160px;
  font-size: 14px;
  color: var(--muted);
}
.form-status[data-tone="error"] {
  color: var(--red);
}

.form-inline {
  display: flex;
  gap: 8px;
  margin: 8px 0 4px;
}
.form-inline .input-group {
  flex: 1 1 auto;
  max-width: 360px;
}

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 6px;
  box-shadow: var(--btn-ring) 0 0 0 1px inset;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 80ms ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover {
  background: var(--hover);
}
.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus) 0 0 0 1px inset, var(--focus-soft) 0 0 0 2px;
}
.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-primary {
  color: #fff;
  background: var(--blue);
  box-shadow: none;
}
.btn-primary:hover {
  background: var(--blue-hover);
}

.btn-lg {
  height: 40px;
  padding: 0 20px;
  font-size: 15px;
}
.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 13px;
}
.btn-ghost {
  box-shadow: none;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 0;
}

/* ---- Receipt ---- */

.id-block {
  margin: 24px 0 8px;
  padding: 16px 18px;
  border-radius: 8px;
  box-shadow: var(--divider) 0 0 0 1px inset;
}
.id-label {
  font-size: 13px;
  color: var(--muted);
}
.id-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.id-value {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

/* ---- Tags ---- */

.tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 3px;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}
.tag-green {
  background: var(--tag-green-bg);
  color: var(--tag-green-text);
}
.tag-yellow {
  background: var(--tag-yellow-bg);
  color: var(--tag-yellow-text);
}

/* ---- Find page list ---- */

.list {
  margin: 16px 0;
  border-top: 1px solid var(--divider);
}
.list-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--divider);
  font-size: 15px;
}
.list-id {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 110px;
}
.list-name {
  flex: 1;
  color: var(--muted);
}

/* ---- Admin ---- */

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px 0;
}
.stat {
  flex: 1 1 160px;
  padding: 12px 14px;
  border-radius: 6px;
  background: var(--callout);
}
.stat-label {
  font-size: 13px;
  color: var(--muted);
}
.stat-value {
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 20px;
  border-bottom: 1px solid var(--divider);
  padding-bottom: 6px;
}
.view-tabs {
  display: flex;
  gap: 2px;
}
.view-tab {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
}
.view-tab:hover {
  background: var(--hover);
}
.view-tab.active {
  color: var(--text);
  font-weight: 500;
  box-shadow: inset 0 -2px 0 var(--text);
  border-radius: 0;
}
.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.toolbar-actions form {
  margin: 0;
}
.search input {
  width: 220px;
  height: 28px;
  padding: 4px 8px;
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th {
  text-align: left;
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
  padding: 8px;
  border-bottom: 1px solid var(--divider);
}
.table th .icon {
  vertical-align: -3px;
  margin-right: 6px;
}
.table td {
  padding: 8px;
  border-bottom: 1px solid var(--divider);
  vertical-align: middle;
}
.table td:not(:nth-child(2)):not(:nth-child(3)) {
  white-space: nowrap;
}
.table tbody tr:hover {
  background: var(--hover);
}
.mono {
  font-variant-numeric: tabular-nums;
}
.table .empty {
  text-align: center;
  color: var(--muted);
  padding: 32px;
}

/* ---- Admin sign-in (Notion login look) ---- */

.auth {
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  padding: 12vh 16px 64px;
}
.auth-logo {
  display: block;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin-bottom: 20px;
}
.auth-title {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 4px;
}
.auth-sub {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 15px;
}
.auth .callout {
  font-size: 14px;
  padding: 12px 12px 12px 10px;
}
.auth-form {
  margin: 0;
}
.auth-field {
  margin-bottom: 14px;
}
.auth-field label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.auth-field input {
  font-size: 15px;
}
.hint {
  margin: 4px 2px 0;
  font-size: 12px;
  color: var(--faint);
}
.btn-block {
  display: flex;
  width: 100%;
  height: 38px;
  margin-top: 6px;
  font-size: 15px;
}
.auth-alt {
  margin: 20px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.admin-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}
.admin-nav {
  display: flex;
  gap: 2px;
}
.admin-bar form {
  margin: 0;
}

/* ---- Small screens ---- */

@media (max-width: 640px) {
  .page {
    padding: 0 16px 48px;
  }
  .cover {
    height: 150px;
    min-height: 0;
  }
  .page-icon-link {
    margin-top: -48px;
  }
  .page-icon {
    width: 88px;
    height: 88px;
  }
  .title {
    font-size: 30px;
    margin-top: 16px;
  }
  .prop-label {
    flex-basis: 120px;
  }
  .field {
    display: block;
    padding: 6px 0;
  }
  .field > label {
    display: block;
    padding: 0 2px 6px;
  }
  .optional {
    display: inline;
    margin-left: 6px;
  }
  input[type="text"],
  input[type="tel"],
  input[type="email"],
  input[type="password"] {
    font-size: 16px; /* stops iOS zooming on focus */
    padding: 10px 12px;
  }
  .submit-row,
  .form-status {
    margin-left: 0;
  }
  .submit-row .btn-lg {
    width: 100%;
    height: 44px;
  }
  .id-value {
    font-size: 28px;
  }
  .search input {
    width: 100%;
  }
  .toolbar-actions {
    width: 100%;
  }
  .toolbar-actions .search {
    flex: 1 1 100%;
  }
}

/* ---- Print (receipt) ---- */

@media print {
  .cover,
  .no-print,
  .btn {
    display: none !important;
  }
  .page-icon-link {
    margin-top: 0;
  }
  body {
    background: #fff;
    color: #000;
  }
}
