:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --line: #d2d2d7;
  --line-soft: #e8e8ed;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --link: #0066cc;
  --green: #1d9a45;
  --red: #d7262b;
  --amber: #b25000;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.47;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; font-size: inherit; }

/* ---- nav ---- */
.nav {
  position: sticky; top: 0; z-index: 50;
  height: 48px;
  background: rgba(251, 251, 253, 0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.nav-inner {
  max-width: 1024px; margin: 0 auto; padding: 0 22px;
  height: 100%; display: flex; align-items: center; gap: 28px;
}
.brand { font-weight: 600; font-size: 19px; letter-spacing: -0.02em; color: var(--text); }
.brand span { color: var(--text-3); font-weight: 400; margin-left: 6px; font-size: 14px; }
.nav-links { display: flex; gap: 24px; margin-left: auto; font-size: 13px; }
.nav-links a, .nav-links button { color: var(--text); opacity: 0.85; background: none; border: 0; padding: 0; cursor: pointer; font-size: 13px; }
.nav-links a:hover, .nav-links button:hover { opacity: 1; text-decoration: none; color: var(--accent); }
.nav-user { color: var(--text-3); }

/* ---- layout ---- */
.wrap { max-width: 1024px; margin: 0 auto; padding: 0 22px; }
.hero { padding: 64px 0 28px; }
.hero h1 { font-size: 48px; line-height: 1.07; font-weight: 600; letter-spacing: -0.03em; margin: 0 0 10px; }
.hero p { font-size: 21px; color: var(--text-2); margin: 0 0 26px; font-weight: 400; max-width: 640px; }
.hero-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: #fff; border: 0; cursor: pointer;
  padding: 10px 22px; border-radius: 980px; font-size: 17px; font-weight: 400;
  transition: background .15s;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-secondary:hover { background: var(--accent); color: #fff; }
.btn-quiet { background: #e8e8ed; color: var(--text); }
.btn-quiet:hover { background: #dedee3; }
.btn-danger { background: transparent; color: var(--red); border: 1px solid var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 14px; }
.link-btn { background: none; border: 0; color: var(--link); cursor: pointer; padding: 0; font-size: 14px; }
.link-btn:hover { text-decoration: underline; }

/* ---- tiles ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin: 0 0 36px; }
.tile { background: var(--surface); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); }
.tile .label { font-size: 13px; color: var(--text-3); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.tile .value { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; margin-top: 4px; line-height: 1.1; }
.tile .sub { font-size: 14px; color: var(--text-2); margin-top: 6px; }
.pos { color: var(--green); }
.neg { color: var(--red); }

/* ---- card / table ---- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 36px; }
.card-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.card-head h2 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.card-head .spacer { flex: 1; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; }
.filters .input { width: auto; min-width: 140px; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-weight: 500; color: var(--text-3); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
.table td { padding: 13px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; transition: background .1s; }
.table tbody tr:hover { background: #fafafc; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .muted { color: var(--text-3); font-size: 13px; }
.name { font-weight: 500; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 980px; font-size: 12px; font-weight: 500; background: #e8e8ed; color: var(--text-2); }
.chip.processed { background: #e3f3e8; color: var(--green); }
.chip.open { background: #e8f0fe; color: var(--accent); }
.chip.clip { background: #f2f2f7; }
.empty { padding: 48px 0; text-align: center; color: var(--text-3); }
.empty strong { display: block; color: var(--text); font-size: 20px; font-weight: 600; margin-bottom: 4px; }

/* ---- forms ---- */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.input, select.input, textarea.input {
  width: 100%; font-family: inherit; font-size: 17px; color: var(--text);
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff;
  outline: none; transition: border-color .15s, box-shadow .15s; appearance: none; -webkit-appearance: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0, 113, 227, .18); }
select.input { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.input.sm { padding: 8px 12px; font-size: 14px; border-radius: 10px; }
select.input.sm { padding-right: 34px; background-position: right 10px center; }
textarea.input { min-height: 84px; resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.seg { display: inline-flex; background: #e8e8ed; border-radius: 10px; padding: 3px; width: 100%; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 15px; color: var(--text-2); transition: all .15s; }
.seg button.on { background: #fff; color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.12); font-weight: 500; }
.seg button.on.deduct { color: var(--red); }
.seg button.on.reimb { color: var(--green); }
.amount-row { display: grid; grid-template-columns: 1fr 150px; gap: 14px; }
.hint { font-size: 13px; color: var(--text-3); margin-top: 6px; }
.error { background: #fff3f3; color: var(--red); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; margin-bottom: 16px; }

/* employee picker */
.picker { position: relative; }
.picker-list { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: #fff; border-radius: var(--radius-sm); box-shadow: 0 12px 40px rgba(0,0,0,.16); max-height: 260px; overflow: auto; z-index: 20; display: none; }
.picker-list.show { display: block; }
.picker-item { padding: 10px 14px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.picker-item:hover, .picker-item.active { background: #f0f5ff; }
.picker-item small { color: var(--text-3); white-space: nowrap; }
.picked { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #f5f5f7; border-radius: var(--radius-sm); font-size: 15px; }
.picked .n { font-weight: 500; }
.picked .num { color: var(--text-3); }

/* attachments */
.drop { border: 1.5px dashed var(--line); border-radius: var(--radius-sm); padding: 20px; text-align: center; color: var(--text-2); font-size: 14px; cursor: pointer; transition: all .15s; }
.drop.over, .drop:hover { border-color: var(--accent); background: #f5f9ff; }
.drop input { display: none; }
.files { list-style: none; padding: 0; margin: 10px 0 0; }
.files li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.files li:last-child { border-bottom: 0; }
.files .size { color: var(--text-3); margin-left: auto; white-space: nowrap; }
.files .rm { color: var(--red); background: none; border: 0; cursor: pointer; font-size: 13px; }

/* ---- sheet / modal ---- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); backdrop-filter: blur(6px); z-index: 100; display: none; align-items: flex-start; justify-content: center; padding: 48px 16px; overflow: auto; }
.overlay.show { display: flex; }
.sheet { background: #fff; border-radius: 22px; width: 100%; max-width: 640px; padding: 32px 32px 24px; box-shadow: 0 30px 80px rgba(0,0,0,.25); animation: pop .18s ease-out; }
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0 } to { transform: none; opacity: 1 } }
.sheet h2 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 4px; }
.sheet .sub { color: var(--text-2); margin: 0 0 24px; font-size: 15px; }
.sheet-actions { display: flex; gap: 12px; align-items: center; margin-top: 24px; }
.sheet-actions .spacer { flex: 1; }
.close { position: absolute; }

/* ---- toast ---- */
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: #1d1d1f; color: #fff; padding: 12px 20px; border-radius: 980px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 200; }
.toast.show { opacity: 1; }

/* ---- footer ---- */
.footer { color: var(--text-3); font-size: 12px; padding: 24px 0 40px; border-top: 1px solid var(--line-soft); }

/* ---- login ---- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-box { width: 100%; max-width: 420px; text-align: center; }
.login-box h1 { font-size: 40px; font-weight: 600; letter-spacing: -0.03em; margin: 0 0 6px; }
.login-box p { color: var(--text-2); margin: 0 0 28px; }
.login-box .card { text-align: left; }
.ms-btn { display: inline-flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); padding: 12px 22px; border-radius: 12px; font-size: 16px; font-weight: 500; color: var(--text); cursor: pointer; }
.ms-btn:hover { border-color: var(--text-3); text-decoration: none; }

@media (max-width: 720px) {
  .hero h1 { font-size: 34px; }
  .hero p { font-size: 17px; }
  .row, .amount-row { grid-template-columns: 1fr; }
  .sheet { padding: 24px 20px; }
  .table .hide-sm { display: none; }
  .nav-links .hide-sm { display: none; }
}
