:root{
  --accent:#8800FF;           /* macOS/iOS system blue */
  --bg: #0f172a;
  --bg-elev: #111827;
  --border:#334155;           /* brighter border for dark mode */
  --text:#e5e7eb;
  --text-muted:#94a3b8;
  --success:#03AAA0;          /* app success green */
  --danger:#FF453A;           /* system red */
}
@media (prefers-color-scheme: light){
  :root{
    --bg:#f5f5f7;
    --bg-elev:#ffffff;
    --border:#d1d5db;         /* slightly darker for better visibility */
    --text:#111827;
    --text-muted:#4b5563;
  }
}

/* Base */
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:'Rubik', -apple-system,BlinkMacSystemFont,"SF Pro Text","SF Pro Display","Helvetica Neue",Arial,sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height:1.5;
}
/* Ensure controls inherit Rubik */
input, select, textarea, button { font-family: inherit; }

/* Force Rubik in upload area controls and action buttons */
.upload-form, .upload-form label, .upload-form input, .upload-form select,
.upload-form button, .uploads-list button, .btn {
  font-family: 'Rubik', -apple-system,BlinkMacSystemFont,"SF Pro Text","SF Pro Display","Helvetica Neue",Arial,sans-serif;
}

/******** Top bar ********/ 
.topbar{
  position:sticky;top:0;z-index:50;
  display:flex;justify-content:space-between;align-items:center;
  height:60px;padding:0 20px;
  backdrop-filter:saturate(180%) blur(20px);
  background:rgba(17,17,17,0.7);
  border-bottom:1px solid var(--border);
}
@media (prefers-color-scheme: light){
  .topbar{background:rgba(255,255,255,0.7)}
}
.topbar .brand{display:flex;align-items:center;gap:12px;font-weight:800;text-decoration:none;color:var(--text);} 
.topbar .brand .logo{height:30px;width:auto;display:block}
.topbar .brand span{font-size:20px;letter-spacing:.02em}
.topbar .nav-right a{margin-left:12px;color:var(--text-muted);text-decoration:none}
.topbar .nav-right a:hover{color:var(--text)}
.topbar a{margin-left:12px;color:var(--text-muted);text-decoration:none}

/******** Layout ********/ 
.container{max-width:1200px;margin:24px auto;padding:0 16px}
.grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.card{background:var(--bg-elev);border:1px solid var(--border);border-radius:12px;padding:20px;box-shadow:0 1px 2px rgba(0,0,0,0.12)}
.card > div:first-child{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.card h3{margin:0;display:flex;align-items:center}
.card.full{grid-column:1/-1}
@media (max-width: 960px){
  .grid{grid-template-columns:1fr}
}

/* Section titles */
.section-title{margin:24px 0 8px 4px;color:var(--text-muted);font-weight:700;letter-spacing:.02em}

/* Uploads list */
.uploads-columns{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.uploads-subtitle{margin:0 0 8px 2px;color:var(--text-muted);font-weight:600}
.uploads-list a{color:#00D8AE;text-decoration:none}
.uploads-list a:hover{text-decoration:underline}
.uploads-list button{height:28px;padding:0 12px;border-radius:8px;border:1px solid var(--border);background:var(--bg);color:var(--text);cursor:pointer}
.uploads-list button:hover{filter:brightness(1.05)}

/******** Feedback ********/ 
.flash{margin-bottom:12px}
.flash-item{padding:10px;border-radius:10px;margin:4px 0}
.flash-item.success{background:rgba(3,170,160,0.2);color:var(--text);border:1px solid rgba(3,170,160,0.6)}
.flash-item.danger{background:rgba(246,105,74,0.2);color:var(--text);border:1px solid rgba(246,105,74,0.6)}
.flash-item a{color:#00D8AE;text-decoration:none}
.flash-item a:hover{text-decoration:underline}

/******** Forms & Buttons ********/ 
.upload-form{display:flex;gap:12px;align-items:end;flex-wrap:wrap}
.upload-form label{display:flex;flex-direction:column;font-size:14px;color:var(--text-muted)}

/* nicer dropdowns */
.upload-form select,#monthSelect{
  height:36px;padding:0 36px 0 12px;border-radius:10px;border:1px solid var(--border);
  background:var(--bg);
  color:var(--text);
  -webkit-appearance:none;-moz-appearance:none;appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5 7l5 6 5-6' stroke='%23a3b3c4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 10px center; background-size:16px;
  transition:border-color .15s ease, box-shadow .15s ease;
}
.upload-form select:hover,#monthSelect:hover{border-color:#3b82f6}
.upload-form select:focus,#monthSelect:focus{box-shadow:0 0 0 3px rgba(10,132,255,0.35)}

.upload-form input{height:36px;padding:0 10px;border-radius:10px;border:1px solid var(--border);background:var(--bg);color:var(--text)}
.upload-form input[type="text"]{line-height:36px}
.upload-form input[type="number"]{-moz-appearance:textfield;appearance:textfield}
.upload-form input[type="number"]::-webkit-outer-spin-button,
.upload-form input[type="number"]::-webkit-inner-spin-button{-webkit-appearance:none;appearance:none;margin:0}

/* Custom number field (steppers removed for now) */
.upload-form button,.btn{height:36px;padding:0 16px;border-radius:10px;border:1px solid var(--accent);background:var(--accent);color:#fff;cursor:pointer}
.upload-form button:hover,.btn:hover{filter:brightness(1.05)}
.upload-form button:active,.btn:active{filter:brightness(0.98)}

/* enhance native file input */
.upload-form input[type="file"]{
  height:36px; border-radius:10px; border:1px solid var(--border); background:var(--bg);
  color:var(--text-muted); padding:0; overflow:hidden; max-width:280px;
}
.upload-form input[type="file"]::file-selector-button{
  height:36px; padding:0 14px; margin-right:12px; border:none; border-right:1px solid var(--border);
  background:var(--accent); color:#fff; cursor:pointer; border-radius:10px 0 0 10px;
  transition:filter .15s ease;
  font-family: 'Rubik', -apple-system,BlinkMacSystemFont,"SF Pro Text","SF Pro Display","Helvetica Neue",Arial,sans-serif;
}
.upload-form input[type="file"]::file-selector-button:hover{filter:brightness(1.05)}
.upload-form input[type="file"]::file-selector-button:active{filter:brightness(0.98)}
/* Safari <15 fallback */
.upload-form input[type="file"]::-webkit-file-upload-button{
  height:36px; padding:0 14px; margin-right:12px; border:none; border-right:1px solid var(--border);
  background:var(--accent); color:#fff; cursor:pointer; border-radius:10px 0 0 10px;
  font-family: 'Rubik', -apple-system,BlinkMacSystemFont,"SF Pro Text","SF Pro Display","Helvetica Neue",Arial,sans-serif;
}

/* Focus ring per HIG */
:focus{outline:none}
.upload-form input:focus,.upload-form select:focus,.upload-form button:focus,#monthSelect:focus,.btn:focus{box-shadow:0 0 0 3px rgba(10,132,255,0.35)}

/******** Table ********/ 
#revTable th,#revTable td{font-size:14px}
#revTable tbody tr:hover{background:rgba(255,255,255,0.03)}
#revTable tfoot td{font-size:15px}

/* Sticky total row for revenues table */
#revTableWrap{position:relative}
#revTable tfoot{position:sticky;bottom:0;background:var(--bg-elev);z-index:5;box-shadow:0 -4px 8px rgba(0,0,0,0.08)}
#revTable tfoot td{border-top:1px solid var(--border)!important}

/* Misc */
.note{margin-top:10px;color:var(--text-muted)}

/******** Banner (Apple HIG aligned) ********/
.banner{display:none; padding:10px 14px; border-radius:12px; border:1px solid var(--border); background:var(--bg-elev); color:var(--text); box-shadow:0 8px 20px rgba(0,0,0,0.12); transform:translateY(-6px); opacity:0; transition:transform .2s ease, opacity .2s ease; display:flex; align-items:center; gap:10px}
@media (prefers-color-scheme: light){ .banner{ box-shadow:0 8px 20px rgba(0,0,0,0.08) } }
.banner--visible{display:flex; transform:translateY(0); opacity:1}
@media (prefers-reduced-motion: reduce){ .banner, .banner--visible{ transition:none; transform:none } }
.banner--success{ border-left:6px solid var(--success) }
.banner__icon{ display:inline-flex; align-items:center; justify-content:center; width:18px; height:18px; border-radius:50%; background:var(--success); color:#fff; font-size:12px; font-weight:800; line-height:1 }
.banner__text{ font-weight:600 }
.banner__close{ margin-left:auto; background:transparent; border:1px solid var(--border); color:var(--text); cursor:pointer; font-weight:700; font-size:16px; line-height:1; padding:2px 6px; border-radius:8px }
.banner__close:hover{ filter:brightness(1.05) }
.banner__close:focus{ box-shadow:0 0 0 3px rgba(10,132,255,0.35) }
