:root {
  --bg-main: #333333;
  --bg-panel: #4d372d;
  --bg-card: #40302a;
  --bg-soft: #2a2a2a;
  --bg-hover: #5b4338;
  --text-main: #ffffff;
  --text-muted: #d9cfc8;
  --accent: #5dc46a;
  --accent-soft: #89db94;
  --danger: #d46a6a;
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font-main: "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(93, 196, 106, 0.08), transparent 34%),
    linear-gradient(180deg, #3a3a3a 0%, #292929 100%);
  color: var(--text-main);
  font-family: var(--font-main);
}

body {
  min-height: 100vh;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login-card {
  width: min(380px, 100%);
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
  background: rgba(77, 55, 45, 0.78);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0;
  font-size: 1.35rem;
}

.login-error {
  margin: 0;
  color: #ffd2d2;
  font-weight: 700;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.72rem 1rem;
  cursor: pointer;
  color: var(--text-main);
  background: var(--bg-panel);
  transition: transform 140ms ease, background 140ms ease, opacity 140ms ease;
}

button:hover {
  background: var(--bg-hover);
}

button:active {
  transform: translateY(1px);
}

button.secondary {
  background: transparent;
  border: 1px solid var(--border);
}

button.positive {
  background: var(--accent);
  color: #122315;
  font-weight: 700;
}

button.danger {
  background: rgba(212, 106, 106, 0.14);
  border: 1px solid rgba(212, 106, 106, 0.35);
  color: #ffd2d2;
}

.shell {
  min-height: 100vh;
  display: block;
}

.tabs-pane,
.list-pane,
.content-pane {
  padding: 1rem;
}

.mobile-topbar {
  display: block;
  padding: 1rem 1rem 0;
}

.tabs-pane {
  display: none;
  border-bottom: 1px solid var(--border);
  background: rgba(30, 30, 30, 0.88);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 15;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.brand h1 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
}

.brand p {
  margin: 0.2rem 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.tab-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.tablet-only-nav {
  display: none;
  margin-bottom: 1rem;
}

.mobile-tabs {
  margin-bottom: 1rem;
}

.mobile-app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.mobile-app-header h1 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
}

.mobile-app-header p {
  margin: 0.18rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.mobile-home-header {
  display: block;
  align-items: center;
  margin-bottom: 0;
}

.mobile-home-header-title {
  text-align: left;
}

.mobile-project-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
}

.mobile-project-header-title {
  text-align: center;
}

.mobile-project-header-title h1 {
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-menu-button {
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.tab-btn {
  width: 100%;
  text-align: left;
  background: var(--bg-soft);
  border: 1px solid transparent;
  border-radius: 0;
}

.tab-btn.active {
  background: var(--bg-panel);
  border-color: rgba(255, 255, 255, 0.2);
}

.tab-btn:hover {
  border-radius: 0;
}

.list-pane {
  display: block;
  border-right: 1px solid var(--border);
  background: rgba(37, 37, 37, 0.9);
}

.content-pane {
  padding-bottom: 5rem;
}

.shell.dashboard-overview .content-pane {
  display: none;
}

.shell.dashboard-overview .list-pane {
  padding-top: 0;
}

.shell.mobile-project-dashboard .list-pane {
  display: none;
}

.shell.mobile-project-dashboard .content-pane {
  padding-top: 0;
}

.shell.mobile-single-list .content-pane {
  display: none;
}

.shell.mobile-single-content .list-pane {
  display: none;
}

.shell.mobile-single-content .content-pane {
  padding-top: 0;
}

.pane-card,
.list-card,
.dashboard-card,
.detail-card,
.week-card {
  background: rgba(77, 55, 45, 0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.list-toolbar,
.content-header,
.modal-header,
.modal-footer,
.inline-actions,
.row-actions,
.week-row,
.employee-chip,
.project-income-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.list-toolbar,
.content-header {
  justify-content: space-between;
  margin-bottom: 1rem;
}

.list-toolbar {
  flex-wrap: wrap;
}

.list-create-row {
  display: flex;
  justify-content: flex-end;
  margin: -0.25rem 0 0.75rem;
}

.mobile-home-create-row {
  margin-top: 0;
}

.list-total-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  padding: 0.85rem 1rem;
  background: rgba(77, 55, 45, 0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.list-total-card span {
  color: var(--text-muted);
}

.list-total-card strong {
  font-size: 20px;
  color: var(--accent-soft);
}

.create-plus-button {
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #122315;
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1;
}

.content-header {
  flex-wrap: wrap;
}

.project-home-back-row {
  justify-content: flex-start;
}

.list-toolbar h2,
.content-header h2,
.modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.list-toolbar p,
.content-header p {
  margin: 0.3rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.list-card {
  overflow: hidden;
}

.list-empty,
.detail-empty {
  padding: 1.2rem;
  color: var(--text-muted);
}

.list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.list-row:last-child {
  border-bottom: 0;
}

.list-row.active,
.list-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.list-row h3,
.detail-title,
.dashboard-card h3,
.week-card h3 {
  margin: 0;
}

.list-row p,
.mini-note,
.entry-meta,
.week-subtitle {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.list-row strong {
  color: var(--accent-soft);
}

.project-list-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dashboard-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-card {
  padding: 1rem;
}

.dashboard-card.clickable {
  cursor: pointer;
}

.dashboard-card.clickable:hover {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(91, 67, 56, 0.84);
}

.dashboard-card.net-income {
  grid-column: 1 / -1;
}

.dashboard-card.net-income h3 {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.dashboard-card.net-income .hero-value {
  font-size: clamp(2rem, 8vw, 3.6rem);
  font-weight: 800;
  line-height: 1;
  margin-top: 0.5rem;
}

.dashboard-card.income .hero-subvalue {
  font-size: 20px;
  color: var(--accent);
  font-weight: 700;
  margin-top: 0.45rem;
}

.dashboard-card.expense .hero-subvalue,
.dashboard-card.summary .hero-subvalue {
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 0.45rem;
}

.dashboard-card.total-expenses .hero-subvalue {
  font-size: 20px;
  color: var(--danger);
}

.dashboard-card .compact-value {
  margin-top: 0.45rem;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-main);
}

.detail-card,
.week-card {
  padding: 1rem;
  margin-bottom: 1rem;
}

.week-card.active {
  border-color: rgba(93, 196, 106, 0.38);
}

.detail-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.detail-card .amount {
  color: var(--accent-soft);
  font-size: 1.2rem;
  font-weight: 700;
}

.row-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 0.8rem;
}

.week-header {
  margin-bottom: 0.9rem;
}

.week-row {
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.9rem 0;
  border-top: 1px solid var(--border);
}

.week-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.week-money {
  text-align: right;
}

.pill-note {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(93, 196, 106, 0.12);
  color: var(--accent-soft);
  border: 1px solid rgba(93, 196, 106, 0.25);
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  font-size: 0.82rem;
}

.project-summary {
  display: grid;
  gap: 1rem;
}

.employee-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.attendance-chip-input {
  display: grid;
  gap: 0.8rem;
}

.attendance-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.attendance-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.45rem 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(93, 196, 106, 0.12);
  border: 1px solid rgba(93, 196, 106, 0.3);
}

.attendance-chip-remove {
  min-width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 999px;
}

.attendance-suggestions {
  display: grid;
  gap: 0.55rem;
}

.attendance-suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  padding: 0.8rem 0.9rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
}

.employee-chip {
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
}

.hidden {
  display: none !important;
}

.modal-root {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(11, 11, 11, 0.55);
  backdrop-filter: blur(10px);
  z-index: 40;
  padding: 1rem;
}

.modal-root.open {
  display: grid;
}

.modal {
  width: min(760px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: linear-gradient(180deg, rgba(77, 55, 45, 0.98), rgba(43, 32, 28, 0.98));
  border-radius: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.mobile-menu-modal .tab-grid {
  grid-template-columns: 1fr;
}

.mobile-menu-modal .tab-btn {
  padding: 0.85rem 0.9rem;
}

.modal-header,
.modal-body,
.modal-footer {
  padding: 1rem 1rem 0;
}

.modal-body {
  padding-bottom: 1rem;
}

.modal-footer {
  padding-bottom: 1rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.modal-delete-button {
  margin-right: auto;
}

.form-grid {
  display: grid;
  gap: 0.9rem;
}

.form-row {
  display: grid;
  gap: 0.9rem;
}

.field label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.8rem 0.9rem;
  background: rgba(18, 18, 18, 0.34);
  color: var(--text-main);
}

.subform-card {
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-md);
  padding: 0.8rem;
  background: rgba(255, 255, 255, 0.03);
}

.subform-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.7rem;
}

.subform-header h3 {
  margin: 0;
  font-size: 0.98rem;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 86px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%) translateY(20px);
  background: #141414;
  color: var(--text-main);
  border-radius: 999px;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 768px) {
  .mobile-topbar {
    display: none;
  }

  .shell.dashboard-overview .content-pane {
    display: block;
  }

  .shell.mobile-project-dashboard .list-pane {
    display: block;
  }

  .shell.mobile-single-list .content-pane,
  .shell.mobile-single-content .list-pane {
    display: block;
  }

  .shell {
    display: block;
  }

  .mobile-app-header {
    display: none;
  }

  .list-pane {
    display: block;
    min-height: 100vh;
  }

  .content-wrap {
    display: grid;
    grid-template-columns: 360px 1fr;
    min-height: 100vh;
  }

  .mobile-tabs {
    display: none;
  }

  .tablet-only-nav {
    display: block;
  }

  .tab-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-row.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .shell {
    display: grid;
    grid-template-columns: 250px 360px 1fr;
  }

  .tabs-pane {
    display: block;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    border-bottom: 0;
    padding: 0.85rem 0.75rem;
  }

  .content-wrap {
    display: contents;
  }

  .mobile-tabs,
  .tablet-only-nav {
    display: none;
  }

  .tab-grid.desktop {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }

  .tab-grid.desktop .tab-btn {
    padding: 0.5rem 0.65rem;
    font-size: 0.9rem;
    line-height: 1.15;
  }

  .brand {
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
  }

  .brand h1 {
    font-size: 1.25rem;
  }

  .brand p {
    font-size: 0.82rem;
  }

  .brand .secondary {
    padding: 0.5rem 0.7rem;
    font-size: 0.84rem;
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
