* { box-sizing: border-box; }
:root { --fs-boost: 0px; }
html, body { height: 100%; margin: 0; }
body {
  background: #EDEBE7;
  font-family: 'Public Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  color: #111;
  overflow-x: hidden;
}
#root { min-height: 100%; }
a { color: #111; text-decoration: none; }
a:hover { color: #5B5751; }
input, select, button { font-family: inherit; }
input:focus, select:focus { border-color: rgba(17,17,17,.35) !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(17,17,17,.16); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

.nav-item:hover { background: rgba(17,17,17,.05); }
.arrow-btn:hover { background: #F2F0EC; }
.item-row:hover { background: #FAF9F7; }
.table-row:hover { background: #FAF9F7; }
.link-btn { cursor: pointer; }
.link-btn:hover { color: #111 !important; }
.chip { cursor: pointer; user-select: none; }
.solid-btn:hover { background: #2C2C2C !important; }
.ghost-btn:hover { background: #F2F0EC !important; }

/* ---------- layout shell ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
  background: #F7F6F3;
}

.sidebar {
  width: 230px;
  flex: none;
  background: #F2F0EC;
  border-right: 1px solid rgba(17,17,17,.09);
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 0 8px; flex: none; }
.sidebar-collapse-btn {
  width: 24px; height: 24px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  color: #8C8880; cursor: pointer; font-size: 15px; line-height: 1;
}
.sidebar-collapse-btn:hover { background: rgba(17,17,17,.06); color: #111; }
.sidebar-toggle {
  width: 34px; height: 34px; flex: none;
  border: 1px solid rgba(17,17,17,.14); border-radius: 8px;
  background: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 15px; line-height: 1; cursor: pointer;
}
.sidebar-nav { margin-top: 26px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
}
.nav-item-active { background: #fff; }
.sidebar-user { margin-top: auto; border-top: 1px solid rgba(17,17,17,.09); padding-top: 16px; flex: none; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; }

.view-header {
  flex: none;
  border-bottom: 1px solid rgba(17,17,17,.09);
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px;
  gap: 12px;
  flex-wrap: wrap;
}
.view-header-title { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.view-header-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.content-scroll { flex: 1; min-height: 0; overflow: auto; }
.view-pad { padding: 20px 28px 40px; }

.two-col { display: flex; gap: 24px; padding: 20px 28px 40px; align-items: flex-start; }
.main-panel { flex: 1; min-width: 0; }
.side-panel { width: 320px; flex: none; display: flex; flex-direction: column; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.item-main { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.item-due { flex: none; text-align: left; }
.item-main > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

.item-icon-btn {
  width: 30px; height: 30px; flex: none; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  color: #A19D95; font-size: 15px; text-decoration: none; cursor: pointer;
}
.item-icon-btn:hover { background: rgba(17,17,17,.07); color: #111; }

.card-mobile-only summary { cursor: pointer; list-style: none; }
.card-mobile-only summary::-webkit-details-marker { display: none; }
.card-mobile-only .chevron { font-size: 10px; color: #A19D95; transition: transform .15s; }
.card-mobile-only[open] .chevron { transform: rotate(180deg); }
.card-mobile-only { display: none; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(17,17,17,.4);
  display: flex; align-items: center; justify-content: center; z-index: 30;
  padding: 24px;
}
.modal-card {
  width: 600px; max-width: 100%; max-height: 88vh;
  background: #F7F6F3; border-radius: 16px; box-shadow: 0 30px 70px rgba(17,17,17,.3);
  overflow: hidden; display: flex; flex-direction: column;
}
.form-row-2, .form-row-3 { display: flex; gap: 16px; }

/* hamburger menu (mobile only) */
.hamburger-wrap { display: none; position: relative; }
.hamburger-btn {
  width: 34px; height: 34px; flex: none;
  border: 1px solid rgba(17,17,17,.14); border-radius: 8px;
  background: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 16px; line-height: 1; cursor: pointer;
}
.mobile-menu-backdrop { position: fixed; inset: 0; background: rgba(17,17,17,.2); z-index: 35; }
.mobile-menu {
  position: absolute; top: 42px; left: 0; z-index: 36; min-width: 190px;
  background: #fff; border: 1px solid rgba(17,17,17,.12); border-radius: 10px;
  box-shadow: 0 14px 30px rgba(17,17,17,.2); overflow: hidden;
}
.mobile-menu-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; font: 500 13px 'Public Sans', sans-serif; color: #55524D; cursor: pointer;
}
.mobile-menu-item:hover { background: #FAF9F7; }
.mobile-menu-item.active { background: #F2F0EC; color: #111; }
.mobile-menu-badge { font: 500 11px 'IBM Plex Mono', monospace; color: #A19D95; }
.mobile-menu-divider { height: 1px; background: rgba(17,17,17,.08); margin: 4px 0; }
.mobile-menu-user { padding: 8px 16px 2px; }

/* ---------- mobile ---------- */

@media (max-width: 820px) {
  :root { --fs-boost: 1.5px; }
  .app-shell { flex-direction: column; }
  .sidebar { display: none; }
  .sidebar-toggle { display: none; }
  .card-desktop-only { display: none; }
  .card-mobile-only { display: block; }
  .hamburger-wrap { display: flex; }

  .main-col { height: auto; min-height: 100vh; }

  .view-header { padding: 14px 12px; }
  .view-header-subtitle { display: none; }
  .view-header-title-text { display: none; }
  .new-expense-label { display: none; }
  .mark-all-link { display: none; }
  .filter-row { width: 100%; flex-wrap: nowrap; }
  .filter-row .chip { flex: 1; text-align: center; white-space: nowrap; }

  .view-pad { padding: 14px 8px 28px; }
  .item-main { flex-direction: column; align-items: flex-start; gap: 1px; }
  .item-due { width: auto; text-align: left; }
  .two-col { flex-direction: column; padding: 14px 8px 28px; gap: 16px; align-items: stretch; }
  .side-panel { width: 100%; order: -1; }

  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal-card { width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; }
  .form-row-2, .form-row-3 { flex-direction: column; gap: 14px; }
  .form-row-3 > div { width: 100% !important; }
}
