/* FileVault — application stylesheet */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1a212b;
  --muted: #67707e;
  --border: #e3e6ea;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0fe;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --ok: #15803d;
  --ok-soft: #e8f7ee;
  --warn: #b45309;
  --warn-soft: #fdf3e3;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }
.hint { color: var(--muted); font-size: .85rem; margin: .35rem 0; }

/* ---------- Admin shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; flex-shrink: 0;
  background: #171e2a; color: #cdd4df;
  display: flex; flex-direction: column;
  padding: 1.1rem .9rem;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: .6rem; padding: .2rem .4rem 1.1rem; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: .8rem;
  flex-shrink: 0;
}
.brand-name { font-weight: 700; color: #fff; font-size: 1.02rem; }
.sidebar nav { display: flex; flex-direction: column; gap: .2rem; }
.nav-link {
  display: block; padding: .55rem .7rem; border-radius: 8px;
  color: #cdd4df; font-weight: 500;
}
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav-link.is-active { background: var(--accent); color: #fff; }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding-top: .9rem; }
.sidebar-user { display: flex; align-items: center; gap: .45rem; font-size: .85rem; margin-bottom: .7rem; }
.sidebar-user .dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; }
.sidebar-version { font-size: .72rem; color: rgba(255,255,255,.45); margin-bottom: .7rem; letter-spacing: .02em; }

.main { flex: 1; min-width: 0; padding: 1.6rem 2rem 3rem; }
.content { max-width: 1060px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.backlink { font-size: .85rem; }
.h-file { word-break: break-all; }
.chips { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.chip {
  background: var(--surface); border: 1px solid var(--border); border-radius: 99px;
  padding: .18rem .75rem; font-size: .82rem; color: var(--muted); box-shadow: var(--shadow);
}
.chip strong { color: var(--text); }
.chip-muted { border-style: dashed; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.2rem 1.3rem; margin-bottom: 1.2rem;
}
.card-flush { padding: 0; overflow: hidden; }
.sep { border: 0; border-top: 1px solid var(--border); margin: 1.1rem 0; }

/* ---------- Flash messages ---------- */
.flash {
  border-radius: 8px; padding: .6rem .9rem; margin: 0 0 .9rem;
  font-size: .9rem; border: 1px solid transparent;
}
.flash-success { background: var(--ok-soft); color: var(--ok); border-color: #bfe8cd; }
.flash-error   { background: var(--danger-soft); color: var(--danger); border-color: #f5c2c2; }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 8px; padding: .45rem .95rem; font-size: .9rem; font-weight: 500;
  cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s;
}
.btn:hover { background: #f6f7f9; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { background: transparent; border-color: transparent; color: #cdd4df; }
.btn-ghost:hover { background: rgba(255,255,255,.08); color: #fff; }
.btn-small { padding: .25rem .6rem; font-size: .8rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn-row { display: flex; gap: .5rem; align-items: center; }

input[type="text"], input[type="password"], input[type="search"], input[type="datetime-local"],
select, input[type="file"], textarea {
  font: inherit; color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: .45rem .7rem; background: var(--surface); min-height: 38px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[readonly] { background: #f6f7f9; color: var(--muted); }
input[disabled], select[disabled] { background: #f0f1f3; color: var(--muted); cursor: not-allowed; }
textarea { width: 100%; min-height: 74px; resize: vertical; }
.wide-field { max-width: 34rem; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }

.stack { display: flex; flex-direction: column; gap: .85rem; align-items: flex-start; }
.stack .btn { align-self: flex-start; }
.stack .btn-block { align-self: stretch; }
.field { display: flex; flex-direction: column; gap: .3rem; width: 100%; max-width: 26rem; }
.field span { font-size: .85rem; font-weight: 600; color: var(--muted); }
.field-inline { flex-direction: row; align-items: center; }
.field-inline span { white-space: nowrap; }
.check { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.check input { width: 16px; height: 16px; }
.group { border: 1px solid var(--border); border-radius: 8px; padding: .8rem 1rem; margin: 0; display: flex; flex-direction: column; gap: .45rem; width: 100%; max-width: 26rem; }
.group legend { font-size: .85rem; font-weight: 600; color: var(--muted); padding: 0 .3rem; }
.code-input { letter-spacing: .5em; font-size: 1.25rem; text-align: center; max-width: 14rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- Upload ---------- */
.dropzone {
  border: 2px dashed #c7ccd6; border-radius: var(--radius);
  padding: 1.6rem; text-align: center; color: var(--muted);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone:focus, .dropzone.is-drag {
  border-color: var(--accent); background: var(--accent-soft); color: var(--accent);
}
.dropzone p { margin: .3rem 0; }
.upload-row { display: flex; align-items: flex-end; gap: .8rem; margin-top: .9rem; flex-wrap: wrap; }
.upload-progress { margin-top: .9rem; }
.progress-track { height: 8px; background: #e8eaee; border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .2s; }
.progress-text { font-size: .82rem; color: var(--muted); margin-top: .3rem; }

/* ---------- Filters & folder strip ---------- */
.filterbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .9rem; }
.search { flex: 1; min-width: 180px; max-width: 340px; }
.folderstrip { display: flex; gap: .45rem; flex-wrap: wrap; margin-bottom: .9rem; }
.pill {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 99px; padding: .22rem .8rem; font-size: .84rem; color: var(--text);
  box-shadow: var(--shadow);
}
.pill:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pill.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill-count { opacity: .7; font-size: .78rem; margin-left: .15rem; }
.pill-add { border-style: dashed; color: var(--muted); }

/* ---------- Table ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th {
  text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: .7rem .9rem; border-bottom: 1px solid var(--border);
  background: #fafbfc;
}
.table td { padding: .6rem .9rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfd; }
.col-num { text-align: right; }
.col-actions { text-align: right; white-space: nowrap; }
.col-actions .btn { margin-left: .3rem; }
.fname { font-weight: 600; color: var(--text); word-break: break-all; }
.fname:hover { color: var(--accent); }
.sub { display: block; font-size: .78rem; color: var(--muted); }
td .sub { display: inline; }
.inline-form { display: inline-block; margin: 0; }
.kv { width: 100%; border-collapse: collapse; font-size: .9rem; }
.kv th { text-align: left; color: var(--muted); font-weight: 600; padding: .3rem .8rem .3rem 0; width: 11rem; }
.kv td { padding: .3rem 0; word-break: break-all; }
.rename-form { display: flex; gap: .4rem; margin-top: .45rem; }
.rename-form input { min-height: 30px; padding: .2rem .5rem; font-size: .85rem; width: 220px; max-width: 100%; }

.badge {
  display: inline-block; border-radius: 99px; padding: .12rem .6rem;
  font-size: .75rem; font-weight: 600;
}
.badge-active   { background: var(--ok-soft); color: var(--ok); }
.badge-expired  { background: var(--danger-soft); color: var(--danger); }
.badge-disabled { background: #eceef1; color: var(--muted); }
.badge-pw       { background: var(--warn-soft); color: var(--warn); }

.empty { text-align: center; padding: 2.6rem 1rem; color: var(--muted); }
.empty p { margin: .2rem 0; }

.pager { display: flex; gap: .3rem; justify-content: center; margin: 1.2rem 0; }
.page {
  min-width: 32px; text-align: center; padding: .3rem .5rem;
  border: 1px solid var(--border); border-radius: 7px; background: var(--surface);
  color: var(--text); font-size: .87rem;
}
.page:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.page.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

.linkrow { display: flex; gap: .5rem; margin: .6rem 0 .9rem; flex-wrap: wrap; }
.linkrow input[type="text"] { flex: 1; min-width: 240px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }

/* ---------- Public pages ---------- */
body.public {
  min-height: 100vh; display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 1rem 2rem;
  background: linear-gradient(180deg, #eef0f6 0%, var(--bg) 100%);
}
.public-wrap {
  width: 100%; display: flex; flex-direction: column; align-items: center;
}
.public-card {
  width: 100%; max-width: 420px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 6px 24px rgba(16,24,40,.08);
  padding: 1.8rem 1.7rem;
}
.card-title { display: flex; align-items: center; gap: .55rem; font-size: 1.25rem; }
.card-sub { color: var(--muted); font-size: .9rem; margin: .2rem 0 1.1rem; }
.errcode { font-size: 2.6rem; font-weight: 800; color: var(--border); letter-spacing: .05em; }

.filebox {
  display: flex; gap: .8rem; align-items: center;
  border: 1px solid var(--border); border-radius: 10px;
  padding: .8rem .9rem; margin-bottom: 1rem; background: #fafbfc;
}
.filebox-name { font-weight: 600; word-break: break-all; }
.filebox-meta { font-size: .82rem; color: var(--muted); }

/* ---------- Etsy promo banner (public download page) ---------- */
.public-promo {
  width: 100%; max-width: 940px; margin-top: 1.6rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 6px 24px rgba(16,24,40,.08);
  padding: 1.4rem 1.5rem 1.5rem;
}
.promo-title {
  display: flex; align-items: center; gap: .5rem;
  font-size: 1.05rem; margin: 0 0 1rem; color: #c34a12;
}
.promo-title svg { color: #f1641e; flex-shrink: 0; }
.etsy-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.etsy-card {
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; box-shadow: var(--shadow);
  text-decoration: none; color: inherit;
  transition: transform .15s ease, box-shadow .15s ease;
}
.etsy-card:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(16,24,40,.14); text-decoration: none; }
.etsy-card img {
  display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  background: #f5f1ee; border-bottom: 1px solid var(--border);
}
.etsy-card .etsy-ph {
  display: flex; align-items: center; justify-content: center;
  width: 100%; aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #fdf3ec, #fae6d8);
  color: #f1641e; border-bottom: 1px solid var(--border);
}
.etsy-card .etsy-caption {
  display: block; padding: .6rem .75rem .15rem; font-size: .86rem; font-weight: 600;
  color: var(--text); word-break: break-word;
}
.etsy-card:hover .etsy-caption { color: var(--accent); }
.etsy-card .etsy-caption::after { content: " \2197"; font-size: .8em; opacity: .6; }
.etsy-card .etsy-price {
  display: block; padding: .1rem .75rem .65rem; font-size: .84rem; font-weight: 700;
  color: #c34a12;
}

/* Etsy products admin page */
.col-order { white-space: nowrap; width: 76px; }
.move-form { margin-right: .25rem; }
.move-form.is-off .btn { opacity: .45; pointer-events: none; }
.etsy-thumb { display: block; margin-top: .45rem; }
.etsy-thumb img {
  display: block; width: 96px; height: 72px; object-fit: cover;
  border: 1px solid var(--border); border-radius: 8px; background: #f5f1ee;
}

/* Settings page — site identity */
.mark-input { width: 5rem !important; text-align: center; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.favicon-row { display: flex; align-items: center; gap: .8rem; margin: .2rem 0 .9rem; }
.favicon-preview {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border: 1px solid var(--border); border-radius: 12px;
  background: #fafbfc; flex-shrink: 0;
}
.favicon-preview img { display: block; width: 48px; height: 48px; object-fit: contain; }

/* ---------- Public shop front (site homepage) ---------- */
body.shop {
  min-height: 100vh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #eef0f6 0%, var(--bg) 100%);
}
.shop-band {
  position: sticky; top: 0; z-index: 40;
  background: #171a21; color: #fff;
  box-shadow: 0 2px 12px rgba(16,24,40,.18);
}
.shop-band-inner {
  max-width: 1120px; margin: 0 auto; padding: .6rem 1.2rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.shop-brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; }
.shop-brand-name { font-weight: 700; color: #fff; font-size: 1.02rem; letter-spacing: .01em; }
.shop-login { margin-left: auto; display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.shop-login input {
  width: 150px; padding: .42rem .65rem; font-size: .85rem;
  border-radius: 8px; border: 1px solid rgba(255,255,255,.28);
  background: rgba(255,255,255,.12); color: #fff;
}
.shop-login input::placeholder { color: rgba(255,255,255,.55); }
.shop-login input:focus { outline: none; border-color: rgba(255,255,255,.65); background: rgba(255,255,255,.18); }
.shop-login .btn { padding: .42rem .9rem; font-size: .85rem; }
.shop-band-user {
  margin-left: auto; display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
  font-size: .85rem; color: rgba(255,255,255,.85);
}
.shop-band-user .dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; }
.shop-band-user form { display: inline; }

.shop-main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: .5rem 1.2rem 2.5rem; }
.shop-hero { text-align: center; padding: 2.6rem .5rem 1.8rem; }
.shop-eyebrow {
  color: #f1641e; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; font-size: .76rem;
}
.shop-hero h1 { font-size: clamp(1.65rem, 4vw, 2.4rem); margin: .35rem 0 .55rem; letter-spacing: -.01em; }
.shop-hero p { color: var(--muted); max-width: 44rem; margin: 0 auto; font-size: .98rem; }

.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: 1.25rem; }
.shop-card .etsy-caption { flex: 1; font-size: .92rem; padding-top: .7rem; }
.shop-card .etsy-caption::after { content: none; }
.shop-card .etsy-price { padding-top: .05rem; font-size: .9rem; }
.shop-cta {
  display: block; margin-top: auto; padding: .6rem .75rem;
  border-top: 1px solid var(--border); font-size: .8rem; font-weight: 600;
  color: #c34a12; background: #fdf8f4;
}
.shop-cta::after { content: " \2197"; font-size: .85em; opacity: .6; }
.shop-card:hover .shop-cta { color: var(--accent); background: var(--accent-soft); }
.shop-note { text-align: center; color: var(--muted); font-size: .85rem; margin: 1.4rem 0 0; }

.shop-empty {
  margin: 1rem auto 0; max-width: 30rem; text-align: center;
  background: var(--surface); border: 1px dashed var(--border); border-radius: 14px;
  padding: 2.6rem 1.5rem; color: var(--muted);
}
.shop-empty svg { color: #f1641e; margin-bottom: .6rem; }
.shop-empty h2 { font-size: 1.15rem; color: var(--text); margin: 0 0 .35rem; }
.shop-empty p { margin: 0 0 1.1rem; font-size: .92rem; }

.shop-foot {
  border-top: 1px solid var(--border); color: var(--muted); font-size: .82rem;
  text-align: center; padding: 1.2rem 1rem 2rem;
}

/* "Visit my shop" link in the download-page banner header */
.promo-shop-link { margin-left: auto; font-size: .8rem; font-weight: 600; color: var(--accent); text-decoration: none; }
.promo-shop-link:hover { text-decoration: underline; }

@media (max-width: 680px) {
  .shop-grid { grid-template-columns: repeat(2, 1fr); gap: .9rem; }
  .shop-card .etsy-caption { font-size: .84rem; }
  .shop-hero { padding: 1.8rem .3rem 1.2rem; }
}
@media (max-width: 560px) {
  .shop-band-inner { padding: .55rem .8rem; }
  .shop-login { margin-left: 0; width: 100%; }
  .shop-login input { flex: 1; min-width: 0; width: auto; }
}

@media (max-width: 640px) {
  .public-promo { padding: 1.1rem 1rem 1.2rem; }
  .etsy-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .etsy-grid { grid-template-columns: 1fr; }
}

.qr-box {
  display: flex; align-items: center; justify-content: center;
  padding: 1rem; border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 1rem; background: #fff;
}
.qr-box svg { display: block; }

/* ---------- Responsive ---------- */
@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; gap: 1rem; flex-wrap: wrap; }
  .sidebar nav { flex-direction: row; }
  .sidebar-foot { margin: 0 0 0 auto; border-top: 0; padding-top: 0; display: flex; align-items: center; gap: .8rem; }
  .sidebar-user { margin-bottom: 0; }
  .main { padding: 1.1rem 1rem 2.5rem; }
  .table th:nth-child(2), .table td:nth-child(2),
  .table th:nth-child(3), .table td:nth-child(3) { display: none; }
}
