/* Cuefolio — Music Stand Clipboard theme */
:root {
  --stand: #1e232b;
  --stand-deep: #14181e;
  --stand-rib: #262d37;
  --parchment: #f4e7c3;
  --parchment-2: #efdba8;
  --parchment-3: #e6cd96;
  --ink: #2c2618;
  --ink-soft: #5a4f36;
  --brass: #d9a441;
  --brass-dark: #a97b26;
  --brass-deep: #7d5a18;
  --latch: #3a4250;
  --latch-hi: #4c5768;
  --danger: #b4483a;
  --hand: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  --cond: "Arial Narrow", "Helvetica Neue", Impact, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  background:
    radial-gradient(120% 90% at 50% -10%, #2a313c 0%, var(--stand) 55%, var(--stand-deep) 100%);
  color: var(--parchment);
  font-family: var(--cond);
  font-size: 17px;
  line-height: 1.35;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

/* music-stand ribs texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    115deg,
    transparent 0 46px,
    rgba(255, 255, 255, 0.025) 46px 48px
  );
  pointer-events: none;
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 14px
           calc(env(safe-area-inset-bottom, 0px) + 96px) 14px;
}

/* ---------- header: spring clip ---------- */
.stand-head { padding: 2px 4px 18px; }

.spring-clip {
  position: relative;
  margin: 0 auto 14px;
  width: 158px;
  height: 44px;
  background: linear-gradient(180deg, #cfd4da 0%, #9aa2ab 45%, #6d747d 80%, #565c64 100%);
  border-radius: 10px 10px 14px 14px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.55), inset 0 2px 2px rgba(255, 255, 255, 0.5);
}
.spring-clip::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -14px;
  transform: translateX(-50%);
  width: 34px;
  height: 22px;
  background: linear-gradient(180deg, #e4e8ec, #8d949c);
  border-radius: 12px 12px 4px 4px;
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.5);
}
.spring-clip::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  height: 5px;
  border-radius: 4px;
  background: repeating-linear-gradient(90deg, #5c626a 0 10px, #878e96 10px 20px);
}

.wordmark {
  text-align: left;
  font-family: var(--cond);
  font-weight: bold;
  font-size: 34px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--brass);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
}
.wordmark small {
  display: block;
  font-size: 12px;
  letter-spacing: 4px;
  color: #8b93a1;
  font-weight: normal;
  margin-top: 2px;
}

/* ---------- tab panels ---------- */
.panel { display: none; animation: rise 0.18s ease-out; }
.panel.on { display: block; }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.panel-title {
  font-size: 15px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #97a0ae;
  margin: 0 0 12px 4px;
  border-bottom: 1px solid rgba(217, 164, 65, 0.25);
  padding-bottom: 6px;
}

/* ---------- brass plaques (dashboard) ---------- */
.plaques {
  display: flex;
  gap: 12px;
  margin: 4px 0 18px;
}
.plaque {
  flex: 1;
  background: linear-gradient(160deg, #f0c666 0%, var(--brass) 40%, var(--brass-dark) 100%);
  border-radius: 8px;
  padding: 14px 12px 12px;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.55), inset 0 1px 1px rgba(255, 255, 255, 0.55), inset 0 -3px 6px rgba(125, 90, 24, 0.6);
  position: relative;
}
.plaque::before {
  /* screw heads */
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #6b5314, #3d2f0c);
  box-shadow: 0 1px 1px rgba(255, 255, 255, 0.3);
  top: 6px; left: 6px;
}
.plaque::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #6b5314, #3d2f0c);
  top: 6px; right: 6px;
}
.plaque .num {
  font-size: 40px;
  font-weight: bold;
  color: #4a3608;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  line-height: 1;
  text-align: center;
}
.plaque .lbl {
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: #4a3608;
  text-align: center;
  font-family: var(--cond);
}
.plaque.low .num { color: #6b1f16; }

/* tuning-fork mark drawn in CSS */
.fork {
  display: block;
  width: 22px;
  height: 30px;
  margin: 0 auto 8px;
  position: relative;
}
.fork::before {
  content: "";
  position: absolute;
  left: 3px; right: 3px; top: 0;
  height: 17px;
  border: 3px solid #4a3608;
  border-bottom: none;
  border-radius: 11px 11px 0 0;
}
.fork::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 15px;
  transform: translateX(-50%);
  width: 3px;
  height: 15px;
  background: #4a3608;
}

/* quick-add brass clip button */
.quick-clip {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  border: none;
  cursor: pointer;
  text-align: left;
  background: linear-gradient(180deg, #e8c668 0%, var(--brass) 55%, #b8862c 100%);
  border-radius: 12px;
  padding: 14px 16px;
  color: #3c2c07;
  font-family: var(--cond);
  font-size: 18px;
  font-weight: bold;
  letter-spacing: 0.5px;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.5);
  margin-bottom: 18px;
}
.quick-clip:active { transform: translateY(2px); }
.quick-clip .jaw {
  flex: none;
  width: 40px;
  height: 26px;
  border-radius: 6px 6px 10px 10px;
  background: linear-gradient(180deg, #6b5314, #3d2f0c);
  position: relative;
}
.quick-clip .jaw::before {
  content: "";
  position: absolute;
  inset: 6px 6px 8px;
  border-radius: 4px;
  background: var(--parchment-3);
}
.quick-clip .sub {
  display: block;
  font-size: 12px;
  font-weight: normal;
  letter-spacing: 1px;
  color: #5d4a17;
}

/* latest slip on dashboard */
.latest-wrap { position: relative; margin-top: 22px; }
.latest-wrap .peek {
  position: absolute;
  top: -14px;
  left: 18px;
  right: 18px;
  height: 30px;
  background: var(--parchment-3);
  border-radius: 4px;
  transform: rotate(-1.4deg);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.45);
}

/* ---------- parchment slips ---------- */
.slip {
  position: relative;
  background: linear-gradient(178deg, var(--parchment) 0%, var(--parchment-2) 100%);
  color: var(--ink);
  border-radius: 3px 6px 4px 5px;
  padding: 16px 14px 12px;
  margin: 0 0 16px;
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.slip::before {
  /* small brass clip on top edge */
  content: "";
  position: absolute;
  top: -3px;
  left: 16px;
  width: 46px;
  height: 14px;
  border-radius: 4px 4px 8px 8px;
  background: linear-gradient(180deg, #f0d488, var(--brass-dark));
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.45), inset 0 1px 1px rgba(255, 255, 255, 0.6);
  z-index: 2;
}
.slip::after {
  /* ruled lines */
  content: "";
  position: absolute;
  left: 10px; right: 10px; bottom: 10px;
  height: 22px;
  background: repeating-linear-gradient(180deg, transparent 0 10px, rgba(90, 79, 54, 0.14) 10px 11px);
  pointer-events: none;
}
.slip .t {
  font-family: var(--cond);
  font-weight: bold;
  font-size: 20px;
  letter-spacing: 0.3px;
  color: var(--ink);
  text-transform: uppercase;
  padding-right: 66px;
  word-break: break-word;
}
.slip .sec {
  font-family: var(--hand);
  font-size: 15px;
  color: var(--ink-soft);
  margin-top: 3px;
}
.slip .rem {
  font-size: 14px;
  color: var(--ink-soft);
  margin-top: 8px;
  font-style: italic;
}
.slip .meta {
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #8a7b57;
  margin-top: 8px;
}

/* circular rubber-stamp tempo badge */
.stamp {
  position: absolute;
  top: 14px;
  right: 12px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px double var(--danger);
  color: var(--danger);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: rotate(8deg);
  background: rgba(180, 72, 58, 0.06);
  z-index: 1;
}
.stamp b { font-size: 17px; line-height: 1; }
.stamp i { font-style: normal; font-size: 9px; letter-spacing: 1px; }
.stamp.gold { border-color: var(--brass-deep); color: var(--brass-deep); background: rgba(217, 164, 65, 0.08); }

/* slip actions */
.slip-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  position: relative;
  z-index: 1;
}
.slip-actions button {
  flex: 1;
  min-height: 44px;
  border: none;
  border-radius: 6px;
  font-family: var(--cond);
  font-size: 15px;
  font-weight: bold;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
}
.btn-edit {
  background: linear-gradient(180deg, var(--brass), var(--brass-dark));
  color: #3c2c07;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.5);
}
.btn-del {
  background: #3a4250;
  color: #e8b7ae;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.12);
}
.slip-actions button:active { transform: translateY(1px); }

/* dashboard latest row */
.latest-row {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  cursor: pointer;
  background: linear-gradient(178deg, var(--parchment), var(--parchment-2));
  color: var(--ink);
  border-radius: 3px 6px 4px 5px;
  padding: 18px 14px 12px;
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.5);
}
.latest-row .tag {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--brass-deep);
  margin-bottom: 4px;
}
.latest-row .t {
  font-weight: bold;
  font-size: 19px;
  text-transform: uppercase;
}
.latest-row .sec { font-family: var(--hand); font-size: 14px; color: var(--ink-soft); margin-top: 2px; }

/* ---------- forms ---------- */
.form-card {
  background: linear-gradient(178deg, var(--parchment), var(--parchment-2));
  color: var(--ink);
  border-radius: 4px 8px 5px 7px;
  padding: 20px 16px 16px;
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.55);
  position: relative;
}
.form-card::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 84px;
  height: 16px;
  border-radius: 5px 5px 10px 10px;
  background: linear-gradient(180deg, #f0d488, var(--brass-dark));
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
}
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 5px;
}
.field input, .field textarea {
  width: 100%;
  min-height: 46px;
  border: none;
  border-bottom: 2px solid var(--brass-deep);
  background: rgba(255, 255, 255, 0.35);
  border-radius: 6px 6px 0 0;
  padding: 10px 12px;
  font-family: var(--cond);
  font-size: 17px;
  color: var(--ink);
  outline: none;
}
.field textarea { min-height: 74px; resize: vertical; }
.field input:focus, .field textarea:focus {
  background: rgba(255, 255, 255, 0.6);
  border-bottom-color: var(--brass-dark);
}
.field input[aria-invalid="true"] { border-bottom-color: var(--danger); background: rgba(180, 72, 58, 0.12); }
.err {
  display: none;
  font-size: 13px;
  color: var(--danger);
  font-weight: bold;
  margin-top: 5px;
}
.err.show { display: block; }
.hint { font-size: 12px; color: #8a7b57; margin-top: 4px; }

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.form-actions button {
  flex: 1;
  min-height: 50px;
  border: none;
  border-radius: 8px;
  font-family: var(--cond);
  font-size: 17px;
  font-weight: bold;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
}
.btn-save {
  background: linear-gradient(180deg, var(--brass), var(--brass-dark));
  color: #3c2c07;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.5);
}
.btn-cancel {
  background: transparent;
  border: 2px solid var(--ink-soft);
  color: var(--ink-soft);
}
.form-actions button:active { transform: translateY(1px); }

/* ---------- find ---------- */
.search-wrap { position: relative; margin-bottom: 14px; }
.search-wrap input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--latch-hi);
  background: rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  padding: 10px 44px 10px 14px;
  color: var(--parchment);
  font-family: var(--cond);
  font-size: 17px;
  outline: none;
}
.search-wrap input:focus { border-color: var(--brass); }
.search-wrap input::placeholder { color: #6d7684; }
.clear-btn {
  position: absolute;
  right: 6px;
  top: 5px;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: var(--latch);
  color: var(--parchment);
  font-size: 18px;
  cursor: pointer;
}
.filter-note {
  font-size: 13px;
  color: #97a0ae;
  margin: 0 4px 12px;
  font-family: var(--hand);
}
.filter-note b { color: var(--brass); font-style: normal; }

.about {
  margin-top: 24px;
  background: var(--stand-rib);
  border: 1px solid rgba(217, 164, 65, 0.3);
  border-radius: 12px;
  padding: 16px;
  font-size: 14px;
  color: #aeb6c2;
}
.about h3 {
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 8px;
}
.about p { margin-bottom: 10px; }
.about .wipe {
  margin-top: 6px;
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--danger);
  background: transparent;
  color: #e8b7ae;
  border-radius: 8px;
  font-family: var(--cond);
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
}

/* ---------- empty states ---------- */
.empty {
  text-align: left;
  padding: 26px 18px;
  border: 2px dashed rgba(217, 164, 65, 0.4);
  border-radius: 12px;
  color: #97a0ae;
}
.empty .big {
  font-family: var(--hand);
  font-size: 22px;
  color: var(--parchment);
  margin-bottom: 6px;
}
.empty p { font-size: 14px; }
.empty.find .big { color: var(--brass); }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 92px);
  transform: translateX(-50%) translateY(20px);
  background: var(--brass);
  color: #3c2c07;
  font-family: var(--cond);
  font-weight: bold;
  font-size: 15px;
  padding: 10px 20px;
  border-radius: 20px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 60;
  max-width: 88vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- bottom tab latches ---------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  gap: 6px;
  background: linear-gradient(180deg, #10141a, #0b0e12);
  padding: 10px 10px calc(env(safe-area-inset-bottom, 0px) + 10px);
  border-top: 2px solid #2c3440;
  box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.6);
}
.tabbar button {
  flex: 1;
  min-height: 56px;
  border: none;
  border-radius: 8px;
  background: #262c35;
  color: #7d8794;
  font-family: var(--cond);
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  position: relative;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6);
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.tabbar button .tick {
  display: block;
  width: 26px;
  height: 4px;
  margin: 4px auto 0;
  border-radius: 2px;
  background: #3a4250;
}
.tabbar button.on {
  background: linear-gradient(180deg, var(--latch-hi), #333b47);
  color: var(--brass);
  transform: translateY(-6px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.65), inset 0 1px 1px rgba(255, 255, 255, 0.25), 0 -2px 0 var(--brass);
}
.tabbar button.on .tick { background: var(--brass); }

/* rotation variety for slips */
.slip:nth-child(odd) { transform: rotate(-0.5deg); }
.slip:nth-child(even) { transform: rotate(0.45deg); }

@media (min-width: 480px) {
  .plaques .num { font-size: 46px; }
}
