/* ProChorus Apple-style look. Loaded after the app's own styles and auth.css, so it only restyles.
   Remove the <link> to ios.css and the <script> for ios.js in index.html to go back to the old look. */
:root {
  --ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  --bg: #f2f2f7; --panel: #ffffff; --panel2: #e9e9ee; --ink: #000000; --muted: #6e6e73; --line: #d1d1d6;
  --accent: #7a1f2b; --accent-ink: #ffffff; --accent-soft: #f6e4e6; --focus: #7a1f2b;
  --segon: #ffffff; --segon-ink: #000000; --bar: rgba(249, 249, 251, .92); --barline: rgba(0, 0, 0, .12);
  --r: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --panel: #1c1c1e; --panel2: #2c2c2e; --ink: #f2f2f7; --muted: #98989f; --line: #38383a;
    --accent: #f5c451; --accent-ink: #000000; --accent-soft: #2a2208; --focus: #f5c451;
    --segon: #636366; --segon-ink: #ffffff; --bar: rgba(36, 36, 38, .92); --barline: rgba(255, 255, 255, .14);
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --panel: #1c1c1e; --panel2: #2c2c2e; --ink: #f2f2f7; --muted: #98989f; --line: #38383a;
  --accent: #f5c451; --accent-ink: #000000; --accent-soft: #2a2208; --focus: #f5c451;
  --segon: #636366; --segon-ink: #ffffff; --bar: rgba(36, 36, 38, .92); --barline: rgba(255, 255, 255, .14);
}
body { -webkit-font-smoothing: antialiased; font-size: 16px; }

/* Buttons and fields */
.btn { border: 0; background: var(--panel2); border-radius: 10px; padding: 8px 14px; font-weight: 500; }
.btn:hover { border-color: transparent; filter: brightness(1.08); }
.btn.primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.danger { color: #ff453a; }
.btn.small { padding: 6px 12px; font-size: 14px; border-radius: 9px; }
.search, .slrow input, .addnew input, .fields input, .sl-meta input[type="date"], .sl-meta textarea, select.sel,
.tm-form input, .tm-inv input, .tm-sel, .editor textarea {
  border: 0; background: var(--panel2); border-radius: 10px; color: var(--ink);
}
.search { height: 38px; padding: 0 10px 0 34px; font-size: 17px;
  background: var(--panel2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2398989f' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E") no-repeat 9px 50%; }
.search::placeholder, .slrow input::placeholder { color: var(--muted); }
.slrow input { height: 44px; font-size: 17px; padding: 0 14px; }
.slrow .btn { min-height: 44px; padding: 0 18px; background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 17px; border-radius: 12px; }
.slrow .btn.danger { background: var(--panel2); color: #ff453a; }

/* Segmented controls (Songs/Setlists on desktop, Live/Archive, chord style, library switch) */
.tabs, .seg3, .folders, .lib-pills { border: 0; border-radius: 10px; background: var(--panel2); padding: 2px; gap: 2px; overflow: hidden; }
.tabs button, .seg3 button, .folders button, .lib-pills button { border: 0 !important; border-radius: 8px; background: transparent; color: var(--ink); font-weight: 500; font-size: 14px; min-height: 32px; }
.tabs button[aria-selected="true"], .seg3 button[aria-pressed="true"], .folders button[aria-pressed="true"], .lib-pills button[aria-pressed="true"] {
  background: var(--segon); color: var(--segon-ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}
.folders { display: flex; margin: 0 0 10px; padding: 2px !important; }
.list > div:has(> .slrow), .list > .sl-actions { padding: 0 0 10px !important; }
.folders .n { font: 500 13px var(--ui); opacity: .8; }
.lib-pills { display: flex; }
.lib-pills button { padding: 6px 12px; }
.lib-pills button.new::after { background: #ff453a; }

/* Song library: rounded grouped list */
.rail { background: var(--bg); border-right: 1px solid var(--line); }
.rail-head { padding: 4px 16px 6px; gap: 10px; }
.ios-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 0; gap: 10px; }
.ios-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 22px; letter-spacing: -.3px; min-width: 0; }
.ios-brand img { width: 36px; height: 36px; border-radius: 9px; flex: none; }
.ios-brand b { color: var(--accent); font-weight: 700; }
.ios-acts { display: flex; gap: 10px; }
.ios-round { width: 44px; height: 44px; border-radius: 22px; border: 0; background: var(--panel); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.ios-round.fill { background: var(--accent); color: var(--accent-ink); }
body.lib-ro .ios-acts .ios-edit { display: none; }
.ios-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 6px 16px 6px; }
.ios-title h1 { margin: 0; font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: -.4px; }
.ios-link { border: 0; background: transparent; color: var(--accent); font-size: 17px; cursor: pointer; padding: 6px 0; min-height: 44px; }
.rail .tabs { display: none; }
.sortrow { font-size: 15px; }
.sortrow label { display: none; }
.sortrow select.sel { flex: none; width: auto; max-width: 60%; background: transparent; color: var(--accent); padding: 4px 0; font-size: 15px; }
.rail-tools { font-size: 15px; }
.rail-tools label { color: var(--accent); }
#count { color: var(--muted); }
body:not(.ios-sel) #list .item > input[type="checkbox"], body:not(.ios-sel) .rail-tools label, body:not(.ios-sel) #btnAddSet, body:not(.ios-sel) .slbar, body:not(.ios-sel) .item .mini { display: none; }
#songsHead .rail-tools + div { min-height: 0; }
#btnAddSet { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

.list { padding: 0 16px 16px; }
.list.has-az { padding-right: 30px; }
.list > .item { background: var(--panel); border-radius: 0; padding: 10px 14px; margin: 0; gap: 12px; align-items: center; min-height: 56px; position: relative; }
.list > .item::after { content: ""; position: absolute; left: 16px; right: 0; bottom: 0; height: .5px; background: var(--line); }
.list > :not(.item) + .item, .list > .item:first-child { border-top-left-radius: var(--r); border-top-right-radius: var(--r); }
.list > .item:has(+ :not(.item)), .list > .item:last-child { border-bottom-left-radius: var(--r); border-bottom-right-radius: var(--r); }
.list > .item:has(+ :not(.item))::after, .list > .item:last-child::after { display: none; }
.list > .item:hover { background: var(--panel); filter: brightness(1.1); }
.list > .item.sel { background: var(--accent-soft); }
.list > .item input[type="checkbox"] { margin: 0; width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.item .t { font-weight: 400; font-size: 17px; line-height: 22px; }
.item .a { font-size: 14px; line-height: 19px; }
.keytag { font: 600 14px var(--ui); padding: 3px 8px; border-radius: 7px; min-width: 30px; text-align: center; }
.item .dt { font: 500 13px var(--ui); }
.item .ord { font: 500 15px var(--ui); margin-top: 0; }
.item .mini button { border: 0; background: var(--panel2); border-radius: 8px; width: 30px; height: 30px; }
.az button { color: var(--accent); font: 600 11px/1.15 var(--ui); }
.empty { text-align: center; }
.slbar { padding: 0 0 8px; }
.sl-actions, .sl-meta, .slrow { padding-left: 0 !important; padding-right: 0 !important; }
.sl-meta label { font-size: 13px; }
.sl-notes { border-left: 0; background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; }

/* Top bar (the song view's navigation bar) */
.top { background: var(--bg); border-bottom: .5px solid var(--barline); }
.top .btn { background: var(--panel); }
.iconbtn { border-radius: 22px; min-width: 40px; min-height: 40px; }
.iconbtn[aria-expanded="true"] { background: #ffe97a; color: #4a3a00; }
.burger[aria-expanded="true"] { background: var(--accent); color: var(--accent-ink); border: 0; }
#burger { border-radius: 22px; min-height: 40px; padding: 8px 14px; }
.top-title { font-size: 17px; font-weight: 600; }

/* Song view */
.setnav .navbtn { border-radius: 22px; min-height: 44px; border: 0; background: var(--panel); }
.setnav .navbtn:not(:disabled) { background: var(--accent-soft); color: var(--accent); }
.notice { border-radius: 10px; }

/* Tools: grouped cards */
.tools { background: var(--bg); border-left: .5px solid var(--barline); }
.tools-head { background: var(--bg); border-bottom: 0; font-size: 22px; padding: 16px 16px 6px; }
.tools-head .btn { width: 30px; height: 30px; border-radius: 15px; padding: 0; font-size: 0; background: var(--panel2); position: relative; }
.tools-head .btn::before { content: "\2715"; font-size: 13px; font-weight: 700; color: var(--muted); }
.tools-body { gap: 18px; padding-top: 6px; }
.tg { background: var(--panel); border-radius: var(--r); padding: 12px; gap: 10px; }
.tg > .lab, .lrow .lab2 { font-size: 13px; letter-spacing: .02em; }
.keygrid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kbtn { border: 0; background: var(--panel2); border-radius: 9px; font: 600 15px var(--ui); padding: 9px 0; }
.kbtn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.step { border: 0; background: var(--panel2); border-radius: 9px; }
.step button { color: var(--accent); font-size: 17px; }
.step output { font: 600 15px var(--ui); }
details.layout { border: 0; background: var(--panel); border-radius: var(--r); padding: 0 14px; }
details.layout[open] summary { border-bottom: .5px solid var(--line); }
.tg .btn { background: var(--panel2); }

/* Menus, sheets and dialogs */
.menu, .addmenu { border: 0; border-radius: 14px; background: var(--panel); box-shadow: 0 12px 40px rgba(0, 0, 0, .45); padding: 6px; }
.mi { border-radius: 9px; font-size: 16px; padding: 11px 14px; }
.mi:hover, .mi:focus-visible { background: var(--panel2); }
.modal { border: 0; border-radius: 16px; }
.modal-wrap, .scrim { background: rgba(0, 0, 0, .55); }
.tm-card, .tm-list, .fmtrow { border: 0; background: var(--panel2); }
.tm-list li { border-top: .5px solid var(--line); }
.toast { border-radius: 14px; background: var(--panel2); color: var(--ink); box-shadow: 0 8px 30px rgba(0, 0, 0, .4); }

/* Bottom tab bar, phones only */
.ios-tabs { display: none; }
@media (max-width: 820px) {
  .rail .ios-title h1 { font-size: 34px; }
  #btnMenu { display: none; }
  .top-title { visibility: hidden; }
  #burger .burger-t { display: inline; }
  #burger { gap: 6px; }
  #burger svg { display: none; }
  #burger::before { content: ""; width: 16px; height: 14px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 14'%3E%3Cpath d='M1 3h9M13 3h2M1 11h2M6 11h9' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3Ccircle cx='11.5' cy='3' r='2' fill='none' stroke='black' stroke-width='1.6'/%3E%3Ccircle cx='4.5' cy='11' r='2' fill='none' stroke='black' stroke-width='1.6'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 14'%3E%3Cpath d='M1 3h9M13 3h2M1 11h2M6 11h9' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3Ccircle cx='11.5' cy='3' r='2' fill='none' stroke='black' stroke-width='1.6'/%3E%3Ccircle cx='4.5' cy='11' r='2' fill='none' stroke='black' stroke-width='1.6'/%3E%3C/svg%3E") center / contain no-repeat; }
  #burger { color: var(--accent); }
  #burger[aria-expanded="true"] { color: var(--accent-ink); }
  #btnRail { background: transparent; color: var(--accent); padding: 8px 6px 8px 2px; font-size: 17px; display: inline-flex; align-items: center; gap: 2px; }
  #btnRail::before { content: ""; width: 11px; height: 11px; border: solid currentColor; border-width: 0 0 2.5px 2.5px; transform: rotate(45deg); margin: 0 4px 0 6px; border-radius: 1px; }
  .top { padding: 6px 10px; }
  .rail.open { top: var(--sat) !important; z-index: 31; padding-bottom: 0; }
  .rail.open .list { padding-bottom: calc(110px + var(--sab)); }
  body.ios-lib .ios-tabs { display: grid; }
  .ios-tabs { position: fixed; left: 50%; transform: translateX(-50%); width: min(310px, calc(100% - 64px)); bottom: calc(16px + var(--sab)); height: 64px; border-radius: 32px;
    background: var(--bar); -webkit-backdrop-filter: blur(20px) saturate(1.6); backdrop-filter: blur(20px) saturate(1.6);
    box-shadow: 0 8px 30px rgba(0, 0, 0, .35), inset 0 0 0 .5px var(--barline); grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: center; padding: 0 6px; z-index: 44; }
  .ios-tabs button { border: 0; background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; font: 500 11px var(--ui); padding: 7px 0; margin: 0 2px; border-radius: 26px; cursor: pointer; }
  .ios-tabs button[aria-current="page"], .ios-tabs button[aria-expanded="true"] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
  /* The main menu opens as a sheet above the tab bar */
  .menu { position: fixed; left: 12px; right: 12px; top: auto; bottom: calc(92px + var(--sab)); min-width: 0; max-height: calc(100dvh - 120px - var(--sat) - var(--sab)); overflow: auto; z-index: 46; }
  .mi { padding: 13px 14px; }
  /* Tools open as a bottom sheet */
  .tools { top: auto !important; left: 0; right: 0; width: 100%; height: min(86dvh, 760px); bottom: 0 !important; border-radius: 16px 16px 0 0; border-left: 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .5); padding-bottom: var(--sab); }
  .tools-head { padding-top: 22px; }
  .tools-head::before { content: ""; position: absolute; top: 7px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: var(--line); }
}
@media (min-width: 821px) {
  .ios-title h1 { font-size: 28px; line-height: 34px; }
  .ios-brand { font-size: 19px; }
  .ios-brand img { width: 30px; height: 30px; border-radius: 7px; }
  .ios-round { width: 36px; height: 36px; }
  .rail .tabs { display: flex; }
  .top .brand { display: none; }
}
/* Dialogs sit above the tab bar; fields inside grey cards stay visible */
.modal-wrap { z-index: 48; }
.tm-card input, .tm-card .tm-sel, .tm-card select { background: var(--panel); }
.tm-list .tm-sel { background: transparent; color: var(--muted); }
.auth-card { border: 0; border-radius: 16px; }
.auth-card input { border: 0; background: var(--panel2); border-radius: 10px; font-size: 17px; }
.auth-card .btn { border-radius: 12px; min-height: 46px; }
.fields input, .fields select { width: 100%; min-width: 0; }
.fields label { min-width: 0; }
