/* Brampton Community Band portal */
:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #1b2422;
  --muted: #66706d;
  --line: #e4e2db;
  --accent: #1f3d36;
  --accent-ink: #ffffff;
  --accent-soft: #e6eeeb;
  --brass: #b0822a;
  --danger: #b3261e;
  --ok: #1e6b47;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 30, 28, .05), 0 4px 16px rgba(20, 30, 28, .04);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); }
a { color: var(--accent); }
h1, h2 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 1.9rem; line-height: 1.2; }
h2 { font-size: 1.25rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.lead { font-size: 1.05rem; margin: .25rem 0 0; }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 20px; }
.main { padding-top: 28px; padding-bottom: 64px; }
form.inline { display: inline; margin: 0; }

/* Top bar */
.topbar { background: var(--accent); color: var(--accent-ink); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-family: var(--serif); font-size: 1.1rem; font-weight: 600; margin-right: auto; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--brass); color: #fff; font-size: 16px; }
.brand-mark.lg { width: 44px; height: 44px; border-radius: 12px; font-size: 22px; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a, .nav .linklike { color: rgba(255, 255, 255, .82); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: .95rem; }
.nav a:hover, .nav .linklike:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.nav a.on { color: #fff; background: rgba(255, 255, 255, .14); }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; }
.menu-toggle { display: none; background: none; border: 0; color: #fff; font-size: 1.4rem; cursor: pointer; padding: 6px 8px; }

/* Page */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.back { display: inline-block; margin-bottom: 10px; text-decoration: none; color: var(--muted); font-size: .95rem; }
.back:hover { color: var(--accent); }
.section { margin: 28px 0 12px; }
.meta-line { margin-top: 24px; }

/* Cards & forms */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card-title { font-size: 1.1rem; margin-bottom: 4px; }
.card.narrow { max-width: 520px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-tight { display: flex; flex-direction: column; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 0; display: flex; flex-direction: column; gap: 14px; }
legend { font-weight: 600; padding: 0 6px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: .95rem; }
.label-text { font-weight: 500; font-size: .95rem; margin-bottom: 6px; }
label small { font-weight: 400; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=search], input:not([type]), select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid #d5d2c9; border-radius: 9px; padding: 11px 13px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 61, 54, .15); }
textarea { resize: vertical; }
.radio, .toggle, .remove { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 400; cursor: pointer; }
.radio input, .toggle input, .remove input { margin-top: 4px; accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.radio-row { display: flex; flex-direction: column; gap: 8px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 500; font-size: .95rem; padding: 10px 16px; border-radius: 9px; border: 1px solid #d5d2c9; background: #fff; color: var(--ink); text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { background: #f1efe9; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #17302a; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(0, 0, 0, .04); }
.btn.small { padding: 6px 11px; font-size: .875rem; }
.btn.big { padding: 13px 18px; font-size: 1rem; }
.btn.block { width: 100%; }
.btn.danger { color: var(--danger); border-color: #e9c3bf; }
.btn.danger:hover { background: #fbeeed; }
.danger-text { color: var(--danger); }
.danger-zone { margin-top: 8px; }

/* Flash messages */
.flash { padding: 12px 14px; border-radius: 9px; margin-bottom: 16px; font-size: .95rem; border: 1px solid; }
.flash-ok { background: #e9f4ee; border-color: #c4e2d1; color: var(--ok); }
.flash-error { background: #fbeeed; border-color: #efc9c5; color: var(--danger); }
.flash-info { background: #f6f1e4; border-color: #e7d9b4; color: #6b5217; }

/* Library */
.searchbar { display: flex; gap: 8px; margin-bottom: 14px; }
.searchbar input { flex: 1; }
.searchbar select { width: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip { text-decoration: none; color: var(--ink); background: #fff; border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; font-size: .9rem; }
.chip span { color: var(--muted); margin-left: 2px; }
.chip:hover { border-color: #cfccc2; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.on span { color: rgba(255, 255, 255, .7); }
.piece-list, .file-list, .member-list, .file-edit, .picked { list-style: none; margin: 0; padding: 0; }
.piece-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.piece-list li + li { border-top: 1px solid var(--line); }
.piece-row { display: flex; align-items: center; gap: 16px; padding: 16px 20px; text-decoration: none; color: inherit; transition: background .12s; }
.piece-row:hover { background: #faf9f6; }
.piece-main { flex: 1; min-width: 0; }
.piece-title { font-family: var(--serif); font-size: 1.12rem; font-weight: 600; }
.piece-credit { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.piece-meta { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .875rem; flex: none; }
.chev { font-size: 1.4rem; line-height: 1; color: #b3b0a6; }
.tag { display: inline-block; background: var(--accent-soft); color: var(--accent); font-size: .78rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.tag.admin { background: #f4ead6; color: #7a5a17; margin-left: 6px; vertical-align: 2px; }
.notes { margin-top: 12px; white-space: normal; }
.card > .tag + .notes { margin-top: 12px; }
.card > .notes:first-child { margin-top: 0; }

/* Files */
.file-list { display: flex; flex-direction: column; gap: 10px; }
.file-list li { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.file-icon { flex: none; width: 46px; height: 54px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: .68rem; font-weight: 700; letter-spacing: .04em; }
.file-main { flex: 1; min-width: 0; }
.file-name { font-weight: 600; overflow-wrap: anywhere; }
.file-actions { display: flex; gap: 8px; flex: none; }
.file-edit { display: flex; flex-direction: column; gap: 8px; }
.file-edit li { display: flex; align-items: center; gap: 12px; }
.file-edit .file-icon { width: 40px; height: 44px; }
.file-edit input { flex: 1; }
.file-edit .remove { flex: none; font-size: .9rem; color: var(--muted); }
.dropzone { position: relative; border: 2px dashed #cfccc2; border-radius: var(--radius); padding: 26px 20px; text-align: center; background: #fbfaf7; transition: border-color .15s, background .15s; }
.dropzone.over, .dropzone.has-files { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dz-text { font-size: 1.02rem; margin-bottom: 4px; }
.dz-text strong { color: var(--accent); }
.picked { margin-top: 10px; font-size: .9rem; }
.picked li { padding: 2px 0; }

/* Members */
.member-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.member-list li { display: flex; align-items: center; gap: 14px; padding: 14px 18px; }
.member-list li + li { border-top: 1px solid var(--line); }
.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-family: var(--serif); }
.member-main { flex: 1; min-width: 0; }
.member-name { font-weight: 600; }
.member-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.copy-card { display: flex; flex-direction: column; gap: 10px; border-color: #e7d9b4; background: #fffcf4; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { font-size: .85rem; }

/* Settings */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; margin-top: 12px; }
.stat { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; }

/* Empty states */
.empty { text-align: center; padding: 56px 20px; background: var(--surface); border: 1px dashed #d5d2c9; border-radius: var(--radius); }
.empty h2 { margin-bottom: 6px; }
.empty .btn { margin-top: 12px; }
.empty-mark { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 26px; }

/* Sign-in pages */
body.bare { background: radial-gradient(1200px 500px at 50% -10%, #e3ebe7 0%, var(--bg) 60%); min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px; box-shadow: 0 10px 40px rgba(20, 30, 28, .08); }
.auth-card.wide { max-width: 640px; }
.auth-card h1 { font-size: 1.6rem; margin: 18px 0 6px; }
.auth-card > p.muted { margin: 0 0 18px; }
.auth-card form { margin-top: 18px; }
.auth-brand { display: flex; align-items: center; gap: 12px; font-family: var(--serif); font-weight: 600; font-size: 1.05rem; color: var(--accent); }
.auth-foot { text-align: center; margin: 18px 0 0; }
.auth-foot + .auth-foot { margin-top: 8px; }

/* Mobile */
@media (max-width: 720px) {
  h1 { font-size: 1.6rem; }
  .menu-toggle { display: block; }
  .nav { display: none; position: absolute; top: 60px; left: 0; right: 0; background: var(--accent); flex-direction: column; align-items: stretch; padding: 8px 12px 14px; box-shadow: 0 8px 20px rgba(0, 0, 0, .15); }
  .nav-open .nav { display: flex; }
  .nav a, .nav .linklike { padding: 12px; text-align: left; width: 100%; }
  .grid2 { grid-template-columns: 1fr; }
  .piece-row { padding: 14px 16px; }
  .piece-meta .count { display: none; }
  .file-list li { flex-wrap: wrap; }
  .file-actions { width: 100%; padding-left: 60px; }
  .member-list li { flex-wrap: wrap; }
  .member-actions { width: 100%; justify-content: flex-start; padding-left: 54px; }
  .card { padding: 18px; }
}

/* ---------- Folders, files and links ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .95rem; margin-bottom: 8px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.head-actions:empty { display: none; }
.notes-card { white-space: normal; }
.narrow-form { max-width: 640px; }
.rows { list-style: none; margin: 0 0 8px; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row + .row { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 14px; padding: 12px 18px; }
.row-link { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; color: inherit; text-decoration: none; margin: -12px -18px; padding: 12px 18px; }
.folder-row:hover, .item-row:hover { background: #faf9f6; }
.row-icon { flex: none; width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; font-size: .62rem; font-weight: 700; letter-spacing: .03em; }
.folder-icon { background: #f4ead6; color: var(--brass); }
.file-icon-sm { background: var(--accent-soft); color: var(--accent); }
.link-icon { background: #e8eef6; color: #2c5a8c; font-size: 1.1rem; font-weight: 600; }
.row-main { flex: 1; min-width: 0; }
.row-name { font-weight: 600; overflow-wrap: anywhere; }
.row-name a { color: inherit; text-decoration: none; }
.row-name a:hover { color: var(--accent); text-decoration: underline; }
.folder-row .row-name { font-family: var(--serif); font-size: 1.08rem; }
.row-main .small a { color: var(--muted); }
.row-actions { display: flex; gap: 6px; flex: none; }
.seg { display: inline-flex; background: #ebe9e2; border-radius: 10px; padding: 4px; margin-bottom: 16px; }
.seg a { padding: 8px 16px; border-radius: 7px; text-decoration: none; color: var(--muted); font-weight: 500; font-size: .95rem; }
.seg a.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.file-summary { display: flex; align-items: center; gap: 12px; padding: 12px; background: #faf9f6; border: 1px solid var(--line); border-radius: 10px; }
[hidden] { display: none !important; }
@media (max-width: 720px) {
  .row { flex-wrap: wrap; padding: 12px 14px; }
  .row-link { margin: -12px -14px; padding: 12px 14px; }
  .item-row .row-actions { width: 100%; padding-left: 54px; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
}
