:root{
    --bg: #FFFFFF;
    --surface: #FFFFFF;
    --surface-2: #F4F4F6;
    --red: #E4002B;
    --red-dark: #A6001F;
    --ink: #141414;
    --ink-dim: #6E6E76;
    --line: #E4E4E9;
    --heat-1: #F28A9E;
    --heat-2: #EB4D6A;
    --heat-3: #E4002B;
    --heat-4: #A6001F;
    --bar-muted: #9C9CA6;
    --gain: #098A43;
    --gain-glow: rgba(34,197,94,0.45);
    --loss-glow: rgba(228,0,43,0.35);
    --radius: 10px;
    --shadow-sm: 0 1px 3px rgba(20,20,20,0.04);
    --shadow-md: 0 8px 20px rgba(20,20,20,0.08);
    --shadow-lg: 0 12px 32px rgba(20,20,20,0.14);
  }
  :root[data-theme="dark"]{
    color-scheme: dark; /* native date/time picker icons follow the theme */
    --bg: #14151A;
    --surface: #1E2028;
    --surface-2: #262933;
    --red: #E4002B;
    --red-dark: #FF4D61;
    --ink: #F2EFEA;
    --ink-dim: #9A9AA5;
    --line: #33353F;
    --heat-1: #9E2440;
    --heat-2: #C4183A;
    --heat-3: #EC3A55;
    --heat-4: #FF7A88;
    --bar-muted: #666A78;
    --gain: #3DDC84;
    --gain-glow: rgba(61,220,132,0.45);
    --loss-glow: rgba(255,77,97,0.4);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 8px 20px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
  }
  *{box-sizing:border-box;}
  html,body{margin:0;padding:0;}
  body{
    background:
      linear-gradient(180deg, rgba(228,0,43,0.06), transparent 220px),
      var(--bg);
    color:var(--ink);
    font-family:'Public Sans', sans-serif;
    min-height:100vh;
    padding:0 0 80px;
    transition:background-color 0.2s ease, color 0.2s ease;
  }
  a{color:var(--red);}

  /* Marquee header */
  .marquee{
    text-align:center;
    padding:56px 20px 40px;
    border-bottom:1px solid var(--line);
    position:relative;
    overflow:hidden; /* floating $ signs never widen the page */
  }
  .marquee::before, .marquee::after{
    content:"";
    position:absolute;
    top:24px;
    width:6px;height:6px;
    border-radius:50%;
    background:var(--red);
    box-shadow:
      0 0 6px 1px rgba(228,0,43,0.35),
      -20px 0 0 0 var(--red), -40px 0 0 0 var(--red), -60px 0 0 0 var(--red),
      20px 0 0 0 var(--red), 40px 0 0 0 var(--red), 60px 0 0 0 var(--red);
    opacity:0.45;
  }
  .marquee::before{left:calc(50% - 140px);}
  .marquee::after{right:calc(50% - 140px);}
  .eyebrow{
    font-family:'IBM Plex Mono', monospace;
    font-size:12px;
    letter-spacing:0.3em;
    color:var(--ink-dim);
    text-transform:uppercase;
    margin-bottom:14px;
  }
  h1.title{
    font-family:'Archivo Black', sans-serif;
    font-size:clamp(26px, 4.5vw, 38px);
    letter-spacing:0.01em;
    margin:0 0 24px;
    color:var(--ink);
  }
  .headline-calc{
    font-family:'IBM Plex Mono', monospace;
    font-size:13px;
    color:var(--ink-dim);
    opacity:0.55;
    margin-bottom:6px;
    min-height:16px;
  }
  .headline-number{
    font-family:'Archivo Black', sans-serif;
    font-size:clamp(52px, 13vw, 116px);
    line-height:0.95;
    color:var(--red);
    margin:0;
  }
  :root[data-theme="dark"] .headline-number{
    text-shadow:0 0 28px rgba(228,0,43,0.35);
  }
  .headline-number.negative{
    color:var(--red-dark);
  }
  .headline-sub{
    font-family:'IBM Plex Mono', monospace;
    font-size:13px;
    color:var(--ink-dim);
    margin-top:10px;
  }
  .stat-row{
    display:flex;
    justify-content:center;
    gap:36px;
    margin-top:28px;
    flex-wrap:wrap;
  }
  .stat{
    font-family:'IBM Plex Mono', monospace;
    text-align:left;
  }
  .stat .num{font-size:20px;color:var(--ink);display:block;}
  .stat .lbl{font-size:11px;color:var(--ink-dim);letter-spacing:0.08em;text-transform:uppercase;}

  /* Layout */
  .wrap{
    max-width:1080px;
    margin:0 auto;
    padding:44px 24px 0;
    display:grid;
    grid-template-columns: 360px 1fr;
    gap:32px;
    align-items:start;
  }
  @media (max-width: 800px){
    .wrap{grid-template-columns:1fr;}
  }
  .left-col, .right-col{min-width:0;}
  .panel{
    background:var(--surface);
    border:1px solid var(--line);
    border-radius:var(--radius);
    padding:24px;
    box-shadow:var(--shadow-sm);
  }
  .panel + .panel{margin-top:24px;}
  .panel h2{
    font-family:'Archivo Black', sans-serif;
    letter-spacing:0.01em;
    font-size:16px;
    margin:0 0 18px;
    color:var(--red);
  }
  label{
    display:block;
    font-size:12px;
    color:var(--ink-dim);
    margin-bottom:6px;
    letter-spacing:0.02em;
  }
  .label-optional{
    font-weight:400;
    text-transform:none;
    opacity:0.8;
  }
  .field{margin-bottom:16px;}
  input[type=text], input[type=number], input[type=date]{
    width:100%;
    background:var(--surface-2);
    border:1px solid var(--line);
    border-radius:6px;
    padding:10px 12px;
    color:var(--ink);
    font-family:'Public Sans', sans-serif;
    font-size:14px;
  }
  input:focus{outline:2px solid var(--red); outline-offset:1px; border-color:var(--red);}
  /* Date fields: the box draws the border and padding and the input inside has none, because iPhone Safari
     adds a date input's padding on top of width:100%, which pushed Date seen into the Showtime box */
  .date-box{
    position:relative;
    background:var(--surface-2);
    border:1px solid var(--line);
    border-radius:6px;
    padding:0 12px;
    overflow:hidden; /* a browser that still sizes the date too wide gets clipped instead of covering its neighbor */
  }
  .date-box:focus-within{outline:2px solid var(--red); outline-offset:1px; border-color:var(--red);}
  .date-box input[type=date]{
    display:block;
    min-width:0;
    max-width:100%;
    margin:0;
    padding:10px 0;
    border:0;
    border-radius:0;
    background:transparent;
  }
  .date-box input[type=date]:focus{outline:none;}
  .date-placeholder{
    display:none;
    position:absolute;
    left:12px; top:50%;
    transform:translateY(-50%);
    color:var(--ink-dim);
    font-size:14px;
    line-height:1.3; /* same as the Showtime button, so the two hints line up */
    pointer-events:none;
  }
  /* iPhone and iPad (the only browsers with -webkit-touch-callout): drop Safari's own date styling, which
     sizes the field to fit the widest possible date, and show "Pick a date" in place of a blank box */
  @supports (-webkit-touch-callout: none){
    .date-box input[type=date]{
      -webkit-appearance:none;
      appearance:none;
      display:flex; /* as Safari does itself, to center the date vertically */
      align-items:center;
      height:40px;
      padding:0;
    }
    .date-box input::-webkit-date-and-time-value{margin:0; text-align:left;}
    .date-box.empty input[type=date]{color:transparent;} /* only "Pick a date" shows, never a hint under it */
    .date-box.empty .date-placeholder{display:block;}
  }
  .row-2{display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:12px;}
  button{
    font-family:'Public Sans', sans-serif;
    font-weight:700;
    font-size:14px;
    cursor:pointer;
    border:none;
    border-radius:6px;
    padding:11px 16px;
  }
  button:focus-visible{outline:2px solid var(--red); outline-offset:2px;}
  .btn-primary{
    width:100%;
    background:var(--red);
    color:#FFFFFF;
  }
  /* Hover colors only where there is a real pointer, so a tapped button on a phone doesn't stay highlighted */
  @media (hover:hover){ .btn-primary:hover{background:var(--red-dark);} }
  .btn-ghost{
    background:transparent;
    color:var(--ink-dim);
    border:1px solid var(--line);
    width:100%;
    margin-top:8px;
  }
  @media (hover:hover){ .btn-ghost:hover{color:var(--red); border-color:var(--red);} }
  .hint{font-size:12px; color:var(--ink-dim); margin-top:4px; line-height:1.5;}

  /* Settings button + dropdown */
  .settings-btn{
    position:fixed;
    top:20px; right:20px;
    width:40px; height:40px;
    background:var(--surface);
    border:1px solid var(--line);
    border-radius:8px;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:5px;
    padding:0;
    z-index:100;
    cursor:pointer;
    box-shadow:var(--shadow-sm);
  }
  @media (hover:hover){ .settings-btn:hover{border-color:var(--red);} }
  .settings-btn span{
    display:block;
    width:18px;
    height:2px;
    background:var(--ink-dim);
    border-radius:1px;
    transition:background 0.15s;
  }
  @media (hover:hover){ .settings-btn:hover span{background:var(--red);} }
  .settings-dropdown{
    position:fixed;
    top:68px; right:20px;
    width:300px;
    max-width:calc(100vw - 40px);
    background:var(--surface);
    border:1px solid var(--line);
    border-radius:var(--radius);
    padding:20px;
    z-index:100;
    display:none;
    box-shadow:var(--shadow-lg);
    max-height:calc(100vh - 88px);
    max-height:calc(100dvh - 88px);
    overflow-y:auto;
  }
  .settings-dropdown.open{display:block;}
  .settings-dropdown h2{
    font-family:'Archivo Black', sans-serif;
    letter-spacing:0.01em;
    font-size:15px;
    margin:0 0 14px;
    color:var(--red);
  }
  .settings-section{margin-bottom:0;}
  .settings-section label{margin-bottom:8px;}
  .settings-section-divider{
    margin-top:18px;
    padding-top:18px;
    border-top:1px solid var(--line);
  }
  .theme-toggle{
    display:flex;
    gap:6px;
  }
  .theme-toggle-btn{
    flex:1;
    background:var(--surface-2);
    border:1px solid var(--line);
    border-radius:6px;
    padding:8px 0;
    font-size:13px;
    font-weight:600;
    color:var(--ink-dim);
    cursor:pointer;
  }
  @media (hover:hover){ .theme-toggle-btn:hover:not(.active){border-color:var(--red); color:var(--red);} }
  .theme-toggle-btn.active{
    background:var(--red);
    color:#FFFFFF;
    border-color:var(--red);
  }

  /* Autocomplete */
  .title-dropdown{
    position:absolute;
    top:100%; left:0; right:0;
    background:var(--surface);
    border:1px solid var(--line);
    border-top:none;
    border-radius:0 0 6px 6px;
    max-height:280px;
    overflow-y:auto;
    z-index:20;
    display:none;
    box-shadow:var(--shadow-md);
  }
  .title-dropdown.open{display:block;}
  .dd-item{
    display:flex;
    gap:10px;
    padding:8px 10px;
    cursor:pointer;
    align-items:center;
  }
  .dd-item:hover, .dd-item.active{background:var(--surface-2);}
  .dd-item img{
    width:32px; height:48px;
    object-fit:cover;
    border-radius:3px;
    background:var(--surface-2);
    flex-shrink:0;
  }
  .dd-item .dd-noimg{
    width:32px; height:48px;
    border-radius:3px;
    background:var(--surface-2);
    flex-shrink:0;
  }
  .dd-title{font-size:13px; color:var(--ink); line-height:1.3;}
  .dd-year{font-size:11px; color:var(--ink-dim);}
  .dd-empty{padding:10px; font-size:12px; color:var(--ink-dim);}

  .selected-meta{
    display:flex;
    gap:12px;
    background:var(--surface-2);
    border:1px solid var(--line);
    border-radius:8px;
    padding:10px;
    margin-bottom:16px;
    align-items:flex-start;
  }
  .selected-meta img{
    width:52px; height:78px;
    object-fit:cover;
    border-radius:4px;
    flex-shrink:0;
  }
  .selected-meta-text{font-size:12px; color:var(--ink-dim); line-height:1.6;}
  .selected-meta-text strong{color:var(--ink); font-weight:600;}
  .selected-meta-clear{
    margin-left:auto;
    background:none; border:none;
    color:var(--ink-dim);
    font-size:11px;
    cursor:pointer;
    text-decoration:underline;
    padding:0;
  }

  .stub-poster{
    width:44px; height:66px;
    object-fit:cover;
    border-radius:4px;
    flex-shrink:0;
  }
  .stub-title-row{display:flex; gap:12px; align-items:flex-start;}

  /* Ticket stubs */
  .stub-list{display:flex; flex-direction:column; gap:14px;}
  .empty-state{
    border:1px dashed var(--line);
    border-radius:var(--radius);
    padding:40px 20px;
    text-align:center;
    color:var(--ink-dim);
    font-size:14px;
  }
  .stub{
    display:grid;
    grid-template-columns: 1fr auto;
    background:var(--surface);
    border:1px solid var(--line);
    border-radius:8px;
    overflow:hidden;
    position:relative;
    box-shadow:var(--shadow-sm);
  }
  .stub-main{padding:16px 18px;}
  .stub-title{
    font-family:'Public Sans', sans-serif;
    font-weight:700;
    font-size:15px;
    color:var(--ink);
    margin-bottom:6px;
  }
  .stub-meta{
    font-family:'IBM Plex Mono', monospace;
    font-size:12px;
    color:var(--ink-dim);
    display:flex;
    gap:16px;
    flex-wrap:wrap;
  }
  .stub-amount{
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    padding:0 18px;
    border-left:2px dashed var(--line);
    font-family:'IBM Plex Mono', monospace;
    position:relative;
    min-width:110px;
  }
  .stub-amount::before, .stub-amount::after{
    content:"";
    position:absolute;
    left:-7px;
    width:14px;height:14px;
    border-radius:50%;
    background:var(--bg);
    border:1px solid var(--line);
  }
  .stub-amount::before{top:-7px;}
  .stub-amount::after{bottom:-7px;}
  .stub-amount .val{font-size:18px; color:var(--red); font-weight:700;}
  .stub-fee-note{
    font-family:'IBM Plex Mono', monospace;
    font-size:10px;
    color:var(--ink-dim);
    margin-top:2px;
  }
  .stub.editing{border-color:var(--red);}
  .stub-actions{display:flex; gap:12px; margin-top:6px;}
  .stub-del, .stub-edit{
    background:none;
    border:none;
    color:var(--ink-dim);
    font-size:11px;
    letter-spacing:0.05em;
    text-transform:uppercase;
    padding:2px 0;
  }
  @media (hover:hover){ .stub-del:hover{color:var(--red-dark);} }
  @media (hover:hover){ .stub-edit:hover{color:var(--red);} }

  footer{
    text-align:center;
    color:var(--ink-dim);
    font-size:12px;
    font-family:'IBM Plex Mono', monospace;
    margin-top:56px;
  }

  /* Movies by Month bar chart */
  .panel-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin-bottom:18px;
    gap:12px;
  }
  .panel-header h2{margin:0;}
  .year-nav{
    display:flex;
    align-items:center;
    gap:8px;
  }
  .year-nav-btn{
    background:none;
    border:1px solid var(--line);
    border-radius:6px;
    width:26px; height:26px;
    padding:0;
    display:flex;
    align-items:center;
    justify-content:center;
    color:var(--ink-dim);
    font-size:16px;
    line-height:1;
    cursor:pointer;
  }
  @media (hover:hover){ .year-nav-btn:hover:not(:disabled){border-color:var(--red); color:var(--red);} }
  .year-nav-btn:disabled{opacity:0.3; cursor:default;}
  .year-nav-label{
    font-family:'IBM Plex Mono', monospace;
    font-size:12px;
    font-weight:600;
    color:var(--ink);
    white-space:nowrap;
  }
  .month-chart{
    display:flex;
    align-items:flex-end;
    height:150px;
    padding-top:22px;
  }
  .month-bar-col{
    flex:1;
    min-width:0;
    height:100%;
    padding:0 3px; /* the space between bars, made part of each column so a tap there still counts */
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:flex-end;
  }
  .month-bar-count{
    font-family:'IBM Plex Mono', monospace;
    font-size:11px;
    font-weight:600;
    color:var(--red);
    margin-bottom:4px;
    min-height:14px;
  }
  .month-bar{
    width:100%;
    max-width:26px;
    background:var(--red);
    border-radius:4px 4px 2px 2px;
    transition:height 0.25s ease, opacity 0.15s ease;
  }
  .month-bar-label{
    font-family:'IBM Plex Mono', monospace;
    font-size:10px;
    letter-spacing:0.04em;
    text-transform:uppercase;
    color:var(--ink-dim);
    margin-top:8px;
  }

  /* Box Office Window: seat inputs + edit banner */
  .seat-inputs{display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:12px;}
  .edit-banner{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    background:var(--surface-2);
    border:1px solid var(--red);
    border-radius:6px;
    padding:8px 12px;
    margin-bottom:16px;
    font-size:13px;
    font-weight:600;
    color:var(--ink);
  }
  .edit-banner span{min-width:0; overflow-wrap:anywhere;}
  .edit-banner-cancel{
    background:none;
    border:none;
    padding:0;
    color:var(--ink-dim);
    font-size:12px;
    text-decoration:underline;
    flex-shrink:0;
  }
  @media (hover:hover){ .edit-banner-cancel:hover{color:var(--red);} }

  /* Billing periods */
  .period-list{display:flex; flex-direction:column; gap:12px;}
  .period{
    background:var(--surface-2);
    border:1px solid var(--line);
    border-radius:8px;
    padding:12px 12px 10px;
  }
  .period .row-2{gap:8px;}
  .period .field{margin-bottom:10px;}
  .period input{min-width:0;}
  @media (max-width: 420px){
    .period .row-2{grid-template-columns:1fr; gap:0;}
  }
  .period .date-box, .period input[type=number]{background:var(--surface);}
  .period .date-box{padding:0 8px;}
  .period input[type=number]{padding:8px; font-size:13px;}
  .period .date-box input[type=date]{padding:8px 0; font-size:13px;}
  .period .date-placeholder{left:8px; font-size:13px;}
  .period-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin-bottom:10px;
  }
  .period-title{
    font-family:'IBM Plex Mono', monospace;
    font-size:11px;
    font-weight:600;
    letter-spacing:0.08em;
    text-transform:uppercase;
    color:var(--ink-dim);
  }
  .period-remove{
    background:none;
    border:none;
    padding:0;
    color:var(--ink-dim);
    font-size:11px;
    letter-spacing:0.05em;
    text-transform:uppercase;
  }
  @media (hover:hover){ .period-remove:hover{color:var(--red-dark);} }
  .period-summary{
    font-family:'IBM Plex Mono', monospace;
    font-size:12px;
    color:var(--ink);
  }
  .period-total{font-family:'IBM Plex Mono', monospace; color:var(--ink);}
  .period-total:empty{display:none;}
  .hint-warn{color:var(--red-dark);}

  /* Where You Watch */
  .highlight{margin-bottom:20px;}
  .highlight-label, .seat-top-label{
    font-family:'IBM Plex Mono', monospace;
    font-size:11px;
    letter-spacing:0.08em;
    text-transform:uppercase;
    color:var(--ink-dim);
  }
  .highlight-name{
    font-size:20px;
    font-weight:700;
    color:var(--ink);
    margin:4px 0 2px;
    overflow-wrap:anywhere;
  }
  .highlight-detail{
    font-family:'IBM Plex Mono', monospace;
    font-size:12px;
    color:var(--ink-dim);
  }
  .loc-list{display:flex; flex-direction:column; gap:12px;}
  .loc-name{
    font-size:13px;
    color:var(--ink);
    margin-bottom:5px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
  .loc-bar-line{display:flex; align-items:center; gap:8px;}
  .loc-bar{
    height:8px;
    min-width:4px;
    background:var(--bar-muted);
    border-radius:0 4px 4px 0;
    transition:width 0.25s ease;
  }
  .loc-bar.top{background:var(--red);}
  .loc-count{
    font-family:'IBM Plex Mono', monospace;
    font-size:12px;
    font-weight:600;
    color:var(--ink);
  }

  /* Seat heatmap */
  .panel-select{
    background:var(--surface-2);
    border:1px solid var(--line);
    border-radius:6px;
    padding:5px 8px;
    color:var(--ink);
    font-family:'IBM Plex Mono', monospace;
    font-size:12px;
    min-width:0;
    max-width:200px;
  }
  .panel-select:focus{outline:2px solid var(--red); outline-offset:1px;}
  .seat-caption{
    font-family:'IBM Plex Mono', monospace;
    font-size:12px;
    color:var(--ink-dim);
    margin-bottom:16px;
    overflow-wrap:anywhere;
  }
  .seat-scroll{overflow-x:auto; padding:2px 2px 4px;}
  /* min-width keeps a wide auditorium from overflowing past the left edge, where it can't be scrolled to */
  .seat-grid{display:grid; gap:2px; justify-content:center; min-width:min-content;}
  .seat-screen{
    text-align:center;
    font-family:'IBM Plex Mono', monospace;
    font-size:10px;
    letter-spacing:0.3em;
    text-transform:uppercase;
    color:var(--ink-dim);
    border-top:3px solid var(--bar-muted);
    border-radius:50% 50% 0 0 / 8px 8px 0 0;
    padding-top:5px;
    margin-bottom:10px;
  }
  .seat-row-label, .seat-num-label{
    font-family:'IBM Plex Mono', monospace;
    font-size:10px;
    color:var(--ink-dim);
    font-variant-numeric:tabular-nums;
  }
  .seat-row-label{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    padding-right:6px;
  }
  .seat-num-label{text-align:center; margin-top:4px;}
  .seat-cell{
    aspect-ratio:1;
    border-radius:3px;
    background:var(--surface-2);
  }
  @media (hover:hover){ .seat-cell:hover{outline:2px solid var(--ink); position:relative; z-index:1;} }
  .seat-cell[data-level="1"], .seat-legend i[data-level="1"]{background:var(--heat-1);}
  .seat-cell[data-level="2"], .seat-legend i[data-level="2"]{background:var(--heat-2);}
  .seat-cell[data-level="3"], .seat-legend i[data-level="3"]{background:var(--heat-3);}
  .seat-cell[data-level="4"], .seat-legend i[data-level="4"]{background:var(--heat-4);}
  .seat-legend{
    display:flex;
    align-items:center;
    flex-wrap:wrap;
    gap:4px;
    margin-top:16px;
    font-family:'IBM Plex Mono', monospace;
    font-size:11px;
    color:var(--ink-dim);
  }
  .seat-legend i{width:14px; height:14px; border-radius:3px; display:inline-block;}
  .seat-legend span:first-child{margin-right:2px;}
  .seat-legend-note{margin-left:10px;}
  .seat-top{margin:16px 0 8px;}
  .seat-top-label{margin-bottom:8px;}
  .seat-chip{
    display:inline-block;
    background:var(--surface-2);
    border:1px solid var(--line);
    border-radius:999px;
    padding:3px 10px;
    margin:0 6px 6px 0;
    font-family:'IBM Plex Mono', monospace;
    font-size:12px;
    color:var(--ink-dim);
  }
  .seat-chip strong{color:var(--ink); font-weight:600;}

  /* When You Watch: hour chart reuses the Movies by Month columns */
  .hour-chart .month-bar-count{color:var(--ink);}
  .hour-chart .month-bar-label{text-transform:none;}
  .month-bar.muted{background:var(--bar-muted);}
  .time-slots{
    display:grid;
    grid-template-columns:repeat(4, minmax(0,1fr));
    gap:12px;
    margin-top:20px;
    padding-top:16px;
    border-top:1px solid var(--line);
  }
  .time-slot{font-family:'IBM Plex Mono', monospace; color:var(--ink-dim);}
  .time-slot .num{display:block; font-size:18px;}
  .time-slot .lbl{display:block; font-size:11px; letter-spacing:0.08em; text-transform:uppercase;}
  .time-slot .range{display:block; font-size:11px; margin-top:2px;}
  .time-slot.top .num, .time-slot.top .lbl{color:var(--ink); font-weight:600;}
  @media (max-width: 560px){
    .hour-chart .month-bar-label.alt{visibility:hidden;} /* every other hour, so labels don't collide */
    .time-slots{grid-template-columns:repeat(2, minmax(0,1fr));}
  }

  /* Bars with movies: hover or Tab for a quick look, click or tap to pin the list under the chart */
  .bar-hit{
    background:none;
    border:0;
    border-radius:6px;
    padding:0 3px;
    color:inherit;
    font:inherit;
    cursor:pointer;
  }
  .bar-hit:focus-visible{outline:2px solid var(--red); outline-offset:0;}
  @media (hover:hover){ .bar-hit:hover .month-bar{box-shadow:0 0 0 2px var(--surface), 0 0 0 3px var(--ink-dim);} }
  .bar-hit.selected .month-bar{box-shadow:0 0 0 2px var(--surface), 0 0 0 4px var(--ink);}
  .has-selection .month-bar-col:not(.selected) .month-bar{opacity:0.35;}
  .bar-detail{margin-top:18px; padding-top:14px; border-top:1px solid var(--line);}
  .bar-detail[hidden]{display:none;}
  .bar-detail-head{display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:10px;}
  .bar-detail-heading{font-size:13px; color:var(--ink-dim);}
  .bar-detail-heading strong{color:var(--ink); font-weight:700;}
  .bar-detail-close{
    flex-shrink:0;
    width:32px; height:32px;
    margin:-4px -6px -4px 0;
    padding:0;
    border-radius:50%;
    background:transparent;
    color:var(--ink-dim);
    font-size:20px;
    font-weight:400;
    line-height:1;
    display:flex;
    align-items:center;
    justify-content:center;
  }
  @media (hover:hover){ .bar-detail-close:hover{background:var(--surface-2); color:var(--ink);} }
  .bar-detail-list{list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:10px;}
  .bar-detail-list li{display:flex; align-items:center; gap:10px;}
  .bar-detail-list img, .bar-detail-noposter{
    width:30px; height:45px;
    flex-shrink:0;
    object-fit:cover;
    border-radius:3px;
    background:var(--surface-2);
  }
  .bar-detail-text{min-width:0;}
  .bar-detail-title{font-size:14px; font-weight:600; color:var(--ink); overflow-wrap:anywhere;}
  .bar-detail-meta{font-family:'IBM Plex Mono', monospace; font-size:11px; color:var(--ink-dim); margin-top:2px; overflow-wrap:anywhere;}
  .bar-tip{
    position:fixed;
    z-index:90; /* under the settings menu */
    max-width:240px;
    padding:10px 12px;
    background:var(--surface);
    border:1px solid var(--line);
    border-radius:8px;
    box-shadow:var(--shadow-lg);
    pointer-events:none;
    font-size:13px;
    color:var(--ink-dim);
  }
  .bar-tip[hidden]{display:none;}
  .bar-tip-value{font-size:15px; font-weight:700; color:var(--ink);}
  .bar-tip-label{font-family:'IBM Plex Mono', monospace; font-size:11px; margin:1px 0 8px;}
  .bar-tip-list{list-style:none; margin:0; padding:8px 0 0; border-top:1px solid var(--line);}
  .bar-tip-list li{color:var(--ink); line-height:1.5; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
  .bar-tip-list .bar-tip-more{color:var(--ink-dim);}
  .bar-tip-hint{margin-top:8px; font-size:11px;}

  /* Why a ticket stub wasn't saved */
  .form-error{margin-top:10px; font-size:13px; font-weight:600; line-height:1.4; color:var(--red-dark);}
  .form-error[hidden]{display:none;}
  input[aria-invalid="true"]{border-color:var(--red-dark);}

  /* Undo bar after removing a ticket stub */
  .undo-toast{
    position:fixed;
    left:50%; bottom:16px;
    transform:translateX(-50%);
    z-index:95;
    display:flex;
    align-items:center;
    gap:14px;
    width:max-content;
    max-width:calc(100vw - 32px);
    padding:8px 8px 8px 16px;
    background:var(--ink);
    color:var(--bg);
    border-radius:10px;
    box-shadow:var(--shadow-lg);
    font-size:14px;
  }
  .undo-toast[hidden]{display:none;}
  .undo-toast span{min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
  .undo-toast button{
    flex-shrink:0;
    min-height:36px;
    padding:6px 14px;
    background:transparent;
    color:inherit;
    border:1px solid currentColor;
    border-radius:6px;
  }
  @media (pointer: coarse){ .undo-toast button{min-height:44px;} }

  /* Your Data: backup export/import */
  .data-status{margin-top:10px;}
  .import-review, .data-status{scroll-margin-bottom:20px;} /* keep the menu's bottom padding when scrolled into view */
  .data-status:empty{display:none;}
  .import-review{
    margin-top:14px;
    padding:12px;
    background:var(--surface-2);
    border:1px solid var(--line);
    border-radius:8px;
  }
  .import-title{font-size:14px; font-weight:700; color:var(--ink);}
  .import-counts{
    font-family:'IBM Plex Mono', monospace;
    font-size:12px;
    color:var(--ink-dim);
    margin:2px 0 8px;
  }
  .import-review .btn-primary{margin-top:10px;}
  .import-cancel{
    display:block;
    margin:10px auto 0;
    background:none;
    border:none;
    padding:0;
    font-size:12px;
    color:var(--ink-dim);
    text-decoration:underline;
  }
  @media (hover:hover){ .import-cancel:hover{color:var(--red);} }
  /* Kept in the layout (not display:none) so older iPhone Safari still opens the file picker */
  .visually-hidden{
    position:absolute;
    width:1px; height:1px;
    margin:-1px; padding:0; border:0;
    overflow:hidden;
    clip:rect(0 0 0 0);
    white-space:nowrap;
  }

  /* Pop-up list pickers: Theater box and Seat Heatmap theater button */
  .picker-field{position:relative;}
  .picker-input{position:relative;}
  .picker-input input{padding-right:38px;}
  .picker-clear{
    position:absolute;
    right:6px; top:50%;
    transform:translateY(-50%);
    width:28px; height:28px;
    padding:0;
    border-radius:50%;
    background:transparent;
    color:var(--ink-dim);
    font-size:20px;
    font-weight:400;
    line-height:1;
    display:flex;
    align-items:center;
    justify-content:center;
  }
  @media (hover:hover){ .picker-clear:hover{background:var(--line); color:var(--ink);} }
  .picker-input input:placeholder-shown + .picker-clear{display:none;}
  .pick-list{
    position:absolute;
    top:calc(100% + 4px); left:0; right:0;
    background:var(--surface);
    border:1px solid var(--line);
    border-radius:8px;
    box-shadow:var(--shadow-md);
    padding:4px;
    max-height:264px;
    overflow-y:auto;
    z-index:30;
    display:none;
  }
  .pick-list.open{display:block;}
  .pick-list-right{left:auto; min-width:240px; max-width:calc(100vw - 65px);} /* 16px gutter on the left */
  .pick-item{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:9px 10px;
    border-radius:6px;
    cursor:pointer;
    font-size:14px;
    color:var(--ink);
  }
  .pick-item:hover, .pick-item.active{background:var(--surface-2);}
  .pick-label{min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
  .pick-label mark{background:none; color:var(--red); font-weight:700;}
  .pick-item.selected .pick-label{font-weight:700;}
  .pick-item.selected .pick-label::before{content:"\2713"; color:var(--red); margin-right:8px;}
  .pick-meta{
    flex-shrink:0;
    font-family:'IBM Plex Mono', monospace;
    font-size:11px;
    color:var(--ink-dim);
  }
  .pick-item.is-new{color:var(--red); font-weight:600;}
  .pick-item.is-new:not(:first-child){margin-top:4px; box-shadow:0 -1px 0 var(--line);}
  .picker-wrap{position:relative; min-width:0; max-width:230px;}
  .picker-button{
    display:inline-flex;
    align-items:center;
    gap:10px;
    max-width:100%; /* shrinks with its wrapper, so a long theater name never runs past the panel */
    font-weight:500;
    cursor:pointer;
  }
  @media (hover:hover){ .picker-button:hover{border-color:var(--red);} }
  .picker-button-text{min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
  .chev{
    flex-shrink:0;
    width:7px; height:7px;
    border-right:2px solid var(--ink-dim);
    border-bottom:2px solid var(--ink-dim);
    transform:translateY(-2px) rotate(45deg);
    transition:transform 0.15s ease;
  }
  .picker-button[aria-expanded="true"] .chev{transform:translateY(2px) rotate(-135deg);}

  /* Showtime picker */
  .time-button{
    width:100%;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    background:var(--surface-2);
    border:1px solid var(--line);
    border-radius:6px;
    padding:10px 12px;
    color:var(--ink);
    font-family:'Public Sans', sans-serif;
    font-size:14px;
    font-weight:400;
    line-height:1.3;
    text-align:left;
    white-space:nowrap;
  }
  @media (hover:hover){ .time-button:hover{border-color:var(--red);} }
  .time-button[aria-expanded="true"]{outline:2px solid var(--red); outline-offset:1px; border-color:var(--red);}
  .time-placeholder{color:var(--ink-dim);}
  .time-icon{width:16px; height:16px; flex-shrink:0; color:var(--ink-dim);}
  .time-panel{
    position:absolute;
    top:calc(100% + 4px); right:0;
    width:300px;
    max-width:calc(100vw - 65px); /* 16px gutter on the left */
    background:var(--surface);
    border:1px solid var(--line);
    border-radius:10px;
    box-shadow:var(--shadow-lg);
    padding:14px;
    z-index:30;
    display:none;
    scroll-margin-bottom:16px;
  }
  .time-panel.open{display:block;}
  .time-head{
    font-family:'IBM Plex Mono', monospace;
    font-size:11px;
    letter-spacing:0.08em;
    text-transform:uppercase;
    color:var(--ink-dim);
    margin-bottom:6px;
  }
  .time-grid{display:grid; grid-template-columns:repeat(6, minmax(0,1fr)); gap:6px; margin-bottom:12px;}
  .time-usual{display:flex; flex-wrap:wrap; gap:6px; margin-bottom:12px;}
  .time-chip{
    padding:8px 0;
    background:var(--surface-2);
    border:1px solid var(--line);
    border-radius:6px;
    color:var(--ink);
    font-family:'IBM Plex Mono', monospace;
    font-size:13px;
    font-weight:600;
  }
  .time-usual .time-chip, .time-ampm .time-chip{padding:7px 12px;}
  @media (hover:hover){ .time-chip:hover:not(.selected){border-color:var(--red); color:var(--red);} }
  .time-chip.selected{background:var(--red); border-color:var(--red); color:#FFFFFF;}
  .time-foot{display:flex; align-items:center; gap:8px;}
  .time-ampm{display:flex; gap:4px;}
  .time-clear{
    margin-left:auto;
    padding:6px 4px;
    background:none;
    color:var(--ink-dim);
    font-size:12px;
    font-weight:600;
    text-decoration:underline;
  }
  @media (hover:hover){ .time-clear:hover{color:var(--red);} }
  .time-done{padding:8px 16px; background:var(--red); color:#FFFFFF; font-size:13px;}
  @media (hover:hover){ .time-done:hover{background:var(--red-dark);} }
  @media (max-width:340px){
    .time-icon{display:none;} /* room for "12:55 PM" on 320px-wide screens */
  }
  @media (max-height:430px){
    /* Landscape phones: a compact panel so AM/PM and Done stay on screen */
    .time-panel{padding:10px;}
    .time-head{margin-bottom:4px;}
    .time-grid, .time-usual{gap:4px; margin-bottom:8px;}
    .time-chip{padding:5px 0;}
    .time-usual .time-chip, .time-ampm .time-chip{padding:5px 12px;}
    .time-done{padding:6px 16px;}
  }

  /* Money animation around the total: green and rising when ahead, red and falling when behind */
  .headline-wrap{
    position:relative;
    width:min(640px, 100%);
    margin:0 auto;
    padding:18px 0;
  }
  .headline-wrap[data-trend="up"]{--trend:var(--gain); --trend-glow:var(--gain-glow);}
  .headline-wrap[data-trend="down"]{--trend:var(--red-dark); --trend-glow:var(--loss-glow);}
  .headline-wrap .headline-number{position:relative; z-index:1;}
  .headline-wrap .headline-number.gain{color:var(--gain); text-shadow:0 0 24px var(--gain-glow);}
  .headline-wrap .headline-number.negative{text-shadow:0 0 24px var(--loss-glow);}
  .trend-art{position:absolute; inset:0; pointer-events:none; display:none;}
  .headline-wrap[data-trend="up"] .trend-art,
  .headline-wrap[data-trend="down"] .trend-art{display:block;}
  .trend-glow{
    position:absolute;
    left:50%; top:50%;
    width:72%; height:100%;
    transform:translate(-50%, -50%);
    background:radial-gradient(ellipse at center, var(--trend-glow) 0%, transparent 70%);
    animation:trendGlow 3.2s ease-in-out infinite;
  }
  .trend-chart{
    position:absolute;
    inset:0;
    width:100%; height:100%;
    overflow:visible;
    color:var(--trend);
    filter:drop-shadow(0 0 6px var(--trend-glow));
    clip-path:inset(-20px 100% -20px -20px);
  }
  .headline-wrap[data-trend="up"] .trend-chart,
  .headline-wrap[data-trend="down"] .trend-chart{animation:trendReveal 1.4s cubic-bezier(0.25, 0.8, 0.3, 1) 0.1s forwards;}
  .trend-line{fill:none; stroke:currentColor; stroke-width:3; stroke-linecap:round; stroke-linejoin:round; opacity:0.75;}
  .trend-area{fill:url(#trendFill);}
  .trend-up, .trend-down{display:none;}
  .headline-wrap[data-trend="up"] .trend-up,
  .headline-wrap[data-trend="down"] .trend-down{display:inline;}
  .trend-dot{
    position:absolute;
    left:98.33%; /* the line's last point, x 590 of 600 */
    width:10px; height:10px;
    margin:-5px 0 0 -5px;
    border-radius:50%;
    background:var(--trend);
    box-shadow:0 0 10px 2px var(--trend-glow);
    opacity:0;
    animation:dotIn 0.3s ease-out 1.4s forwards;
  }
  .headline-wrap[data-trend="up"] .trend-dot{top:7%;}    /* y 14 of 200 */
  .headline-wrap[data-trend="down"] .trend-dot{top:93%;} /* y 186 of 200 */
  .trend-dot::after{
    content:"";
    position:absolute;
    inset:0;
    border-radius:50%;
    border:2px solid var(--trend);
    opacity:0;
    animation:dotPing 1.8s ease-out 1.6s infinite;
  }
  .money{
    position:absolute;
    left:var(--x); top:var(--y);
    font-family:'Archivo Black', sans-serif;
    font-size:var(--s);
    line-height:1;
    color:var(--trend);
    text-shadow:0 0 10px var(--trend-glow);
    opacity:0;
    transform:translate(-50%, -50%);
  }
  .headline-wrap[data-trend="up"] .money{animation:moneyUp var(--t) ease-in-out var(--d) infinite;}
  .headline-wrap[data-trend="down"] .money{animation:moneyDown var(--t) ease-in var(--d) infinite;}
  @keyframes trendGlow{
    0%, 100%{opacity:0.35; transform:translate(-50%, -50%) scale(0.92);}
    50%{opacity:0.7; transform:translate(-50%, -50%) scale(1.06);}
  }
  @keyframes trendReveal{
    to{clip-path:inset(-20px -20px -20px -20px);}
  }
  @keyframes dotIn{to{opacity:1;}}
  @keyframes dotPing{
    0%{transform:scale(1); opacity:0.8;}
    100%{transform:scale(3); opacity:0;}
  }
  @keyframes moneyUp{
    0%{opacity:0; transform:translate(-50%, -50%) translateY(18px) scale(0.7);}
    20%{opacity:0.9;}
    70%{opacity:0.6;}
    100%{opacity:0; transform:translate(-50%, -50%) translateY(-64px) scale(1.1);}
  }
  @keyframes moneyDown{
    0%{opacity:0; transform:translate(-50%, -50%) translateY(-40px) rotate(-8deg);}
    20%{opacity:0.85;}
    70%{opacity:0.55;}
    100%{opacity:0; transform:translate(-50%, -50%) translateY(56px) rotate(28deg) scale(0.75);}
  }
  @media (prefers-reduced-motion: reduce){
    /* Keep the line, dot and colors, without movement */
    .trend-glow, .trend-dot::after{animation:none;}
    .headline-wrap[data-trend="up"] .trend-chart,
    .headline-wrap[data-trend="down"] .trend-chart{animation:none; clip-path:none;}
    .trend-dot{animation:none; opacity:1;}
    .money{display:none;}
  }

  /* Phones and tablets */
  html{-webkit-text-size-adjust:100%; text-size-adjust:100%;} /* no text enlarging when a phone turns sideways */
  button, input, .pick-item, .dd-item{touch-action:manipulation;} /* quick double taps on chips never zoom the page */
  @media (pointer: coarse){
    /* 16px text keeps iPhone Safari from zooming the page in whenever a field is tapped */
    input[type=text], input[type=number], .time-button, .date-box input[type=date], .date-placeholder,
    .period input[type=number], .period .date-box input[type=date], .period .date-placeholder{font-size:16px;}
    /* Tap targets at least 44px tall, Apple's guideline */
    input[type=text], input[type=number], .time-button, .btn-primary, .btn-ghost, .theme-toggle-btn{min-height:44px;}
    .date-box input[type=date]{min-height:42px;} /* plus the box's border */
    .settings-btn{width:44px; height:44px;}
    .year-nav-btn{width:36px; height:36px; font-size:20px;}
    .panel-select{min-height:36px;}
    .picker-input input{padding-right:46px;}
    .picker-clear{width:40px; height:40px; right:3px;}
    .pick-item{padding:12px; font-size:16px;}
    .dd-item{padding:10px 12px;}
    /* Small text buttons get a bigger tap area; the negative margins keep their text where it was */
    .stub-edit, .stub-del{padding:14px 6px; margin:-12px -6px;}
    .period-remove, .edit-banner-cancel{padding:12px 8px; margin:-12px -8px;}
    .selected-meta-clear{padding:12px 8px; margin:-12px -8px -12px auto;}
    .import-cancel{padding:10px 8px; margin:0 auto -10px;}
    .time-clear{padding:12px 6px;}
    .bar-detail-close{width:40px; height:40px; margin:-8px -10px -8px 0;}
  }
  @media (pointer: coarse) and (min-height: 431px){
    /* Bigger showtime chips, except on a sideways phone where the compact panel has to fit */
    .time-chip{padding:11px 0;}
    .time-usual .time-chip, .time-ampm .time-chip{padding:10px 14px;}
    .time-done{padding:11px 18px;}
  }
  @media (max-width: 560px){
    /* More room for the panels: 16px side gutters */
    .marquee{padding:60px 16px 32px;}
    .wrap{padding:24px 16px 0; gap:16px;}
    .panel{padding:20px 18px;}
    .panel + .panel{margin-top:16px;}
    .panel-header h2{white-space:nowrap;}
    #monthPanel .panel-header{flex-wrap:wrap; row-gap:10px;} /* the year arrows take their own line when they don't fit */
    .pick-list-right, .time-panel{max-width:calc(100vw - 51px);} /* still a 16px gutter on the left */
    /* The menu button scrolls away with the header instead of floating over the panels */
    .settings-btn{position:absolute; top:12px; right:12px;}
    .settings-dropdown{position:absolute; top:64px; right:12px; max-width:calc(100vw - 24px);}
    /* Shorter rows of marquee lights, clear of the menu button */
    .marquee::before, .marquee::after{
      box-shadow:
        0 0 6px 1px rgba(228,0,43,0.35),
        -20px 0 0 0 var(--red), -40px 0 0 0 var(--red),
        20px 0 0 0 var(--red), 40px 0 0 0 var(--red);
    }
    .marquee::before{left:calc(50% - 96px);}
    .marquee::after{right:calc(50% - 96px);}
    .stat-row{display:grid; grid-template-columns:repeat(2, auto); justify-content:center; gap:18px 40px; margin-top:24px;}
    /* Ticket stubs: the price moves under the details, across a dashed tear line */
    .stub{grid-template-columns:minmax(0,1fr);}
    .stub-main{padding:14px 16px;}
    .stub-amount{
      flex-direction:row;
      flex-wrap:wrap;
      justify-content:flex-start;
      gap:2px 10px;
      min-width:0;
      padding:10px 16px 12px;
      border-left:none;
      border-top:2px dashed var(--line);
    }
    .stub-amount::before, .stub-amount::after{top:-8px; bottom:auto;}
    .stub-amount::before{left:-8px;}
    .stub-amount::after{left:auto; right:-8px;}
    .stub-fee-note{margin-top:0;}
    .stub-actions{margin:0 0 0 auto;}
  }
  @media (max-width: 380px){
    .marquee::before{left:calc(50% - 76px);}
    .marquee::after{right:calc(50% - 76px);}
  }
  @media (max-width: 359px){
    #boxOfficePanel > .row-2{grid-template-columns:minmax(0,1fr); gap:0;} /* Date seen and Showtime each get a full row */
    .marquee::before, .marquee::after{box-shadow:0 0 6px 1px rgba(228,0,43,0.35), -20px 0 0 0 var(--red), 20px 0 0 0 var(--red);}
  }
