/* ============================================================
   BARS ADMIN LINKS — coo.barscrew.org

   Same palette as barscrew.org (tokens copied from its
   assets/css/portal.css, which itself copies the public site).
   Amber is reserved for the primary action.
   ============================================================ */

:root {
  --ink:        #16303C;
  --ink-muted:  #4A6470;
  --blue:       #0B6FB8;
  --blue-strong:#075A97;
  --blue-ink:   #0A3550;
  --amber:      #F5A00A;
  --amber-ink:  #331F00;
  --amber-light:#FFC65C;
  --white:      #FFFFFF;
  --paper:      #FAF7F2;
  --paper-2:    #F1EDE6;
  --line:       #E2DBD1;
  --line-strong:#CFC5B8;
  --danger:     #A32020;
  --danger-bg:  #FBEAEA;

  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 10px;
  --gutter: clamp(1rem, 4vw, 2rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2 { margin: 0; font-family: var(--font-serif); font-weight: 600; line-height: 1.2; }
a { color: var(--blue-strong); }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35em;
  min-height: 44px; padding: .55em 1.1em;
  border: 1px solid transparent; border-radius: 8px;
  font: 600 1rem/1.2 var(--font-sans);
  text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary { background: var(--amber); color: var(--amber-ink); }
.btn-primary:hover { background: var(--amber-light); }
.btn-ghost { background: transparent; color: inherit; border-color: currentColor; }
.btn-ghost:hover { background: rgba(127,127,127,.12); }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-bg); }
.btn-block { width: 100%; }
.btn span[aria-hidden] { font-size: 1.3em; line-height: 1; }

/* ---------- PIN / reset cards ---------- */
.gate { background: var(--blue-ink); }
.card-wrap {
  flex: 1; display: grid; place-items: center;
  padding: max(var(--gutter), env(safe-area-inset-top)) var(--gutter) var(--gutter);
}
.card {
  width: 100%; max-width: 380px;
  background: var(--white); border-radius: 14px;
  padding: 2rem 1.5rem 1.5rem; text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.card-logo { display: block; margin: 0 auto .75rem; }
.card h1 { font-size: 1.6rem; margin-bottom: 1.25rem; }
.card form { text-align: left; }
.card label { display: block; font-weight: 600; font-size: .95rem; margin: .75rem 0 .3rem; }
.card-note { color: var(--ink-muted); margin: 0 0 1.25rem; }
.card-foot { margin: 1.25rem 0 0; font-size: .95rem; }
.card input[type=email] {
  width: 100%; font-size: 1.05rem; padding: .7em .8em;
  border: 1px solid var(--line-strong); border-radius: 8px;
}
.pin-input {
  display: block; width: 100%;
  font: 600 2rem/1 var(--font-sans); letter-spacing: .6em; text-align: center;
  padding: .45em 0 .45em .6em;
  border: 2px solid var(--line-strong); border-radius: 10px;
  background: var(--paper);
}
.pin-input:focus { border-color: var(--blue); outline: none; }
.form-error { color: var(--danger); font-size: .95rem; min-height: 1.4em; margin: .6rem 0; }
.form-error:empty { min-height: .4em; }

/* ---------- Top bar ---------- */
.topbar {
  background: var(--blue-ink); color: var(--white);
  padding-top: env(safe-area-inset-top);
  position: sticky; top: 0; z-index: 5;
}
.topbar-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem var(--gutter);
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.brand { display: flex; align-items: center; gap: .7rem; color: inherit; text-decoration: none; min-width: 0; }
.brand img { flex: none; background: var(--white); border-radius: 50%; padding: 2px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font: 600 1.3rem/1.15 var(--font-serif); }
.brand-sub { font-size: .8rem; color: #A9C2D3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; gap: .5rem; flex: none; }
.topbar .btn-ghost { color: var(--white); border-color: rgba(255,255,255,.5); }

/* ---------- Link buttons ---------- */
.page {
  flex: 1; width: 100%; max-width: 1100px; margin: 0 auto;
  padding: 1.5rem var(--gutter) 2rem;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.links {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: .85rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px)  { .links { grid-template-columns: repeat(2, 1fr); gap: 1rem; } }
@media (min-width: 1000px) { .links { grid-template-columns: repeat(3, 1fr); } }

.link-row { display: flex; gap: .5rem; align-items: stretch; }
.link-btn {
  flex: 1; min-width: 0;
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  min-height: 76px; padding: 1rem 1.15rem;
  background: var(--white); color: var(--ink); text-decoration: none;
  border: 1px solid var(--line); border-left: 5px solid var(--blue);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(22,48,60,.06);
  font: 600 1.2rem/1.25 var(--font-sans);
  transition: border-color .15s, box-shadow .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.link-btn:hover { border-color: var(--blue); box-shadow: 0 4px 14px rgba(22,48,60,.12); }
.link-btn:active { transform: scale(.985); }
.link-title { overflow-wrap: anywhere; }
.link-arrow { flex: none; color: var(--blue); font-size: 1.4rem; line-height: 1; }

/* Edit mode: buttons stop navigating and grow small controls. */
.editing .link-btn { border-left-color: var(--amber); cursor: default; }
.editing .link-btn:active { transform: none; }
.editing .link-arrow { display: none; }
.link-tools { display: none; flex-direction: column; gap: .35rem; }
.editing .link-tools { display: flex; }
.tool {
  width: 44px; flex: 1; min-height: 34px;
  display: grid; place-items: center;
  background: var(--white); color: var(--ink-muted);
  border: 1px solid var(--line-strong); border-radius: 8px;
  font-size: 1rem; cursor: pointer;
}
.tool:hover:not(:disabled) { color: var(--blue-strong); border-color: var(--blue); }
.tool:disabled { opacity: .35; cursor: default; }
.link-edit-hint { font-size: .85rem; font-weight: 500; color: var(--ink-muted); }

.edit-hint { margin: 0 0 1rem; color: var(--ink-muted); font-size: .95rem; }
.empty { text-align: center; color: var(--ink-muted); padding: 3rem 1rem; }

/* ---------- Footer ---------- */
.footer {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem .6rem;
  padding: 1rem var(--gutter) max(1.25rem, env(safe-area-inset-bottom));
  color: var(--ink-muted); font-size: .9rem;
}
.linkish {
  background: none; border: 0; padding: .4rem .2rem; cursor: pointer;
  color: var(--ink-muted); font: inherit; text-decoration: underline; text-underline-offset: 2px;
}
.linkish:hover { color: var(--ink); }

/* ---------- Add / edit pop-up ---------- */
.modal {
  width: min(460px, calc(100vw - 2rem));
  padding: 0; border: 0; border-radius: 14px;
  color: var(--ink); background: var(--white);
  box-shadow: 0 24px 60px rgba(0,0,0,.3);
}
.modal::backdrop { background: rgba(10,53,80,.55); }
.modal form { padding: 1.5rem; }
.modal h2 { font-size: 1.4rem; margin-bottom: .75rem; }
.modal label { display: block; font-weight: 600; font-size: .95rem; margin: .9rem 0 .3rem; }
.modal input {
  width: 100%; font-size: 1.05rem; /* 16px+ stops iOS zooming in */
  padding: .7em .8em; border: 1px solid var(--line-strong); border-radius: 8px;
}
.modal input:focus { border-color: var(--blue); outline: 2px solid var(--blue); outline-offset: -1px; }
.modal-actions { display: flex; gap: .5rem; align-items: center; margin-top: .5rem; }
.modal-actions .spacer { flex: 1; }

/* Narrow phones: keep the header on one line. */
.brand-name, .link-edit-hint { white-space: nowrap; }
@media (max-width: 420px) {
  .brand img { width: 38px; height: 38px; }
  .brand-name { font-size: 1.15rem; }
  .brand-sub { display: none; }
  .topbar-actions .btn { padding-left: .85em; padding-right: .85em; }
}
