/* PayDrop: Firebase-console inspired styling */
:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --text: #202124;
  --muted: #5f6368;
  --line: #e0e3e7;
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --nav: #1f2a3c;
  --nav-text: #c3cad6;
  --nav-active: #ffffff;
  --accent: #ffa000;
  --ok: #188038;
  --warn: #b06000;
  --err: #d93025;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(60,64,67,.15), 0 1px 3px 1px rgba(60,64,67,.08);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font: 14px/1.45 Roboto, "Segoe UI", Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 400; margin: 0 0 4px; }
h2 { font-size: 16px; font-weight: 500; margin: 0 0 12px; }
h3 { font-size: 13px; font-weight: 500; margin: 12px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: "Roboto Mono", Consolas, monospace; font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.block { display: block; }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.err { color: var(--err); }
.mt { margin-top: 24px; }
.ic { width: 18px; height: 18px; fill: currentColor; flex: none; }

/* Top bar + side nav */
.topbar { position: fixed; inset: 0 0 auto 0; height: 56px; background: var(--nav); color: #fff; display: flex; align-items: center; gap: 14px; padding: 0 16px; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 18px; font-weight: 500; }
.brand:hover { text-decoration: none; }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #ffca28, #ff8f00); color: #1f2a3c; font-weight: 700; }
.logo.big { width: 48px; height: 48px; font-size: 24px; border-radius: 12px; }
.project { color: var(--nav-text); border-left: 1px solid #3c4a62; padding-left: 14px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spacer { flex: 1; }
.user { display: flex; align-items: center; gap: 8px; }
.user-meta { display: flex; flex-direction: column; font-size: 13px; line-height: 1.2; }
.user-meta small { color: var(--nav-text); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #5e97f6; display: grid; place-items: center; font-weight: 500; }
.icon-link { color: var(--nav-text); display: grid; place-items: center; padding: 6px; border-radius: 50%; }
.icon-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.menu-btn { display: none; background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; }
.sidenav { position: fixed; top: 56px; bottom: 0; left: 0; width: 232px; background: var(--nav); padding: 8px 0; display: flex; flex-direction: column; z-index: 15; overflow-y: auto; }
.nav-label { color: #8a96a8; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 12px 24px 8px; }
.sidenav a { display: flex; align-items: center; gap: 14px; color: var(--nav-text); padding: 10px 24px; font-size: 14px; border-left: 3px solid transparent; }
.sidenav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.sidenav a.active { color: var(--nav-active); background: rgba(255,255,255,.1); border-left-color: var(--accent); }
.nav-foot { margin-top: auto; color: #6b778a; font-size: 11px; padding: 12px 24px; }
.content { margin: 56px 0 0 232px; padding: 24px 32px 48px; max-width: 1500px; }

/* Page header */
.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; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 4px; }

/* Cards */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 24px; margin-bottom: 20px; }
.card.narrow { max-width: 640px; }
.card.empty { text-align: center; padding: 48px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.cards .card { margin: 0; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 32px; font-weight: 400; margin: 4px 0 8px; }
.stat-value.small { font-size: 20px; margin-top: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2 > .card { margin-bottom: 20px; }
.split { display: flex; gap: 20px; align-items: flex-start; }
.grow { flex: 1; min-width: 0; }

/* Department rail */
.dept-list { width: 200px; flex: none; padding: 8px 0; position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto; }
.dept-list a { display: flex; justify-content: space-between; gap: 8px; padding: 9px 16px; color: var(--text); border-left: 3px solid transparent; }
.dept-list a:hover { background: #f1f3f4; text-decoration: none; }
.dept-list a.active { background: #e8f0fe; color: var(--primary); border-left-color: var(--primary); font-weight: 500; }
.dept-list small { color: var(--muted); font-variant-numeric: tabular-nums; }
.dept-list small.ok { color: var(--ok); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: 4px; border: 1px solid #dadce0; background: #fff; color: var(--primary); font: 500 14px Roboto, Arial, sans-serif; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f6fafe; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-small { height: 30px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }
.btn.danger, button.danger { color: var(--err); }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 0; background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: #f1f3f4; color: var(--primary); }
.icon-btn.send { color: var(--primary); }
.icon-btn:disabled { opacity: .3; cursor: not-allowed; }
details.menu { position: relative; }
details.menu summary { list-style: none; }
details.menu summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: 40px; background: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.18); border-radius: 6px; padding: 6px 0; min-width: 300px; z-index: 30; }
.menu-list a, .menu-list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 16px; background: none; border: 0; color: var(--text); font: 14px Roboto, Arial, sans-serif; text-align: left; cursor: pointer; }
.menu-list a:hover, .menu-list button:hover { background: #f1f3f4; text-decoration: none; }
.menu-list form { margin: 0; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid #f1f3f4; vertical-align: middle; }
.table tr:hover td { background: #f8fafd; }
.table.compact td, .table.compact th { padding: 7px 10px; }
.table td.actions, .table th.actions { text-align: right; white-space: nowrap; }
.table.rows td { padding: 8px 8px; }
.table.rows td { white-space: nowrap; }
.table.rows td small.block { font-size: 11px; }
.card.tight { padding: 16px; }
.table.rows .icon-btn { width: 30px; height: 30px; }
.table th.num { text-align: right; }
.table.rows td:nth-child(3) { max-width: 210px; overflow: hidden; text-overflow: ellipsis; }
.table td.email { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .cb { width: 32px; }
.table input:not([type=checkbox]), .table select { height: 32px; padding: 0 8px; border: 1px solid #dadce0; border-radius: 4px; font: inherit; }
.dot-warn { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: #fce8b2; color: var(--warn); font-size: 11px; font-weight: 700; cursor: help; }

/* Chips */
.chip { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; background: #f1f3f4; color: var(--muted); white-space: nowrap; vertical-align: middle; }
.chip-small { font-size: 11px; padding: 0 8px; background: #fef7e0; color: var(--warn); }
.chip-draft { background: #f1f3f4; color: var(--muted); }
.chip-ready { background: #e8f0fe; color: var(--primary); }
.chip-changed { background: #fef7e0; color: var(--warn); }
.chip-sent { background: #e6f4ea; color: var(--ok); }
.chip-test { background: #f3e8fd; color: #8430ce; }
.chip-failed { background: #fce8e6; color: var(--err); }
.chip-open { background: #e8f0fe; color: var(--primary); font-size: 13px; }
.chip-closed { background: #e6f4ea; color: var(--ok); font-size: 13px; }

/* Toolbars */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar.sticky { position: sticky; top: 56px; z-index: 5; background: var(--bg); padding: 10px 0; }
.search { display: flex; gap: 8px; flex-wrap: wrap; }
.search input, .search select, .inline-form select { height: 36px; padding: 0 12px; border: 1px solid #dadce0; border-radius: 4px; font: inherit; background: #fff; }
.search input[type=search] { width: 240px; }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.bulkbar { display: flex; align-items: center; gap: 10px; background: #e8f0fe; padding: 8px 12px; border-radius: 6px; margin-bottom: 10px; }
.progress-row { display: flex; align-items: center; gap: 12px; margin: 8px 0 16px; }
.progress-row .bar { flex: 1; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label, .fields-2 label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.form input:not([type=checkbox]):not([type=radio]), .form select, .form textarea, .fields-2 input, .fields-2 select {
  height: 38px; padding: 0 12px; border: 1px solid #dadce0; border-radius: 4px; font: 14px Roboto, Arial, sans-serif; color: var(--text); background: #fff; }
.form textarea { height: auto; padding: 10px 12px; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus, .grid input:focus { outline: 2px solid #aecbfa; border-color: var(--primary); }
.form input[readonly] { background: #f8f9fa; }
label.check { flex-direction: row !important; align-items: center; gap: 8px !important; color: var(--text) !important; font-size: 14px !important; }
.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.fields-2.amounts label.row-lbl { flex-direction: row; justify-content: space-between; align-items: center; }
.fields-2.amounts label.row-lbl input { width: 130px; height: 32px; text-align: right; }
.fields-2.amounts label.total { font-weight: 500; color: var(--text); }
.form-actions { display: flex; gap: 8px; margin-top: 8px; }
fieldset { border: 0; padding: 0; margin: 0; }
fieldset.testbox { background: #f3e8fd; border-radius: 6px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.radio-cards { display: flex; flex-direction: column; gap: 8px; }
.radio-cards legend { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.radio-card { flex-direction: row !important; align-items: flex-start; gap: 10px !important; border: 1px solid #dadce0; border-radius: 6px; padding: 12px; cursor: pointer; }
.radio-card span { display: flex; flex-direction: column; color: var(--text); }
.radio-card small { color: var(--muted); }
.radio-card:has(input:checked) { border-color: var(--primary); background: #f6fafe; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 14px; border-left: 4px solid; background: #fff; box-shadow: var(--shadow); }
.alert-success { border-color: var(--ok); }
.alert-error { border-color: var(--err); color: #a50e0e; }
.alert-warn { border-color: #f9ab00; }
.alert-info { border-color: var(--primary); }
.issue { font-size: 12px; }
.issue-error { color: var(--err); }
.issue-warn { color: var(--warn); }
.issue-info { color: var(--muted); }

/* Review grid */
.grid-wrap { padding: 0; overflow: auto; max-height: calc(100vh - 230px); }
.grid { border-collapse: separate; border-spacing: 0; font-size: 13px; }
.grid th { position: sticky; top: 0; background: #f1f3f4; font-weight: 500; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); white-space: nowrap; z-index: 2; }
.grid thead tr:nth-child(2) th { top: 29px; }
.grid th.group { text-align: center; }
.grid th.g-earnings { background: #e6f4ea; }
.grid th.g-deductions { background: #fce8e6; }
.grid th.g-totals { background: #e8f0fe; }
.grid td { padding: 2px 4px; border-bottom: 1px solid #f1f3f4; border-right: 1px solid #f1f3f4; background: #fff; white-space: nowrap; }
.grid tr.has-issue td { background: #fffbf0; }
.grid input { border: 1px solid transparent; background: transparent; height: 28px; padding: 0 6px; font: inherit; border-radius: 3px; }
.grid input:hover { border-color: #dadce0; }
.grid input.dirty { background: #fef7e0; border-color: #f9ab00; }
.grid .w-num { width: 90px; text-align: right; }
.grid .w-txt { width: 130px; }
.grid .w-name { width: 190px; font-weight: 500; }
.grid .sticky-col { position: sticky; left: 0; z-index: 1; }
.grid .sticky-col2 { position: sticky; left: 78px; z-index: 1; box-shadow: 2px 0 0 var(--line); }
.grid th.sticky-col, .grid th.sticky-col2 { z-index: 3; }
.grid td.sticky-col { min-width: 78px; }
.grid td.issues { min-width: 260px; white-space: normal; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs a { padding: 10px 18px; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 500; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs a:hover { text-decoration: none; color: var(--text); }

/* Progress modal */
.modal { position: fixed; inset: 0; background: rgba(32,33,36,.5); display: grid; place-items: center; z-index: 50; }
.modal[hidden] { display: none; }
.modal-card { background: #fff; border-radius: 8px; padding: 24px; width: min(520px, 92vw); box-shadow: 0 8px 32px rgba(0,0,0,.3); }
.modal-card h3 { text-transform: none; letter-spacing: 0; color: var(--text); font-size: 18px; font-weight: 400; margin: 0 0 16px; }
.bar { height: 6px; background: #e8eaed; border-radius: 3px; overflow: hidden; }
.bar.big { height: 8px; }
.bar > div { height: 100%; width: 0; background: var(--primary); transition: width .3s; }
.progress-row .bar > div { background: var(--ok); }
.errors { max-height: 200px; overflow-y: auto; padding-left: 18px; color: var(--err); font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; }
.pager { display: flex; gap: 8px; margin-top: 12px; }

/* Auth pages */
.auth-body { display: grid; place-items: center; min-height: 100vh; background: linear-gradient(160deg, #1f2a3c 0 40%, var(--bg) 40%); padding: 16px; }
.auth-card { background: #fff; border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.18); padding: 32px; width: min(420px, 100%); }
.auth-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.auth-brand p { margin: 0; }
.auth-alert { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); }

@media (max-width: 1500px) {
  .split { flex-direction: column; gap: 0; }
  .split > .grow { width: 100%; }
  .dept-list { width: 100%; position: static; max-height: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; margin-bottom: 16px; }
  .dept-list a { border-left: 0; border-radius: 16px; padding: 6px 14px; background: #f1f3f4; }
  .dept-list a.active { border-left: 0; }
}
@media (max-width: 1000px) {
  .grid-2, .fields-2 { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .menu-btn { display: block; }
  .sidenav { transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidenav { transform: none; }
  .content { margin-left: 0; padding: 16px; }
  .project, .user-meta { display: none; }
  .search input[type=search] { width: 100%; }
}

input.masked { -webkit-text-security: disc; font-family: monospace; }
