:root {
  --blue: #168cff;
  --blue-strong: #0f6cf6;
  --cyan: #45b7ff;
  --green: #20b66b;
  --orange: #ff8b3d;
  --red: #e85b5b;
  --purple: #7c5cff;
  --text: #172033;
  --sub: #5d6b82;
  --muted: #97a3b6;
  --line: #e7edf5;
  --bg: #eef3f9;
  --panel: #ffffff;
  --soft: #f6f9fd;
  --shadow: 0 18px 42px rgba(35, 84, 140, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease, opacity 0.16s ease;
}

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

.hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px;
  background:
    linear-gradient(135deg, rgba(15, 108, 246, 0.95), rgba(49, 177, 255, 0.9)),
    var(--bg);
}

.login-shell {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) 420px;
  gap: 28px;
  align-items: stretch;
}

.login-brand,
.login-panel,
.card {
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.login-brand {
  min-height: 480px;
  padding: 44px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(16, 86, 226, 0.78), rgba(50, 183, 255, 0.58)),
    #168cff;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 22px;
  font-weight: 900;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.brand-mark.small {
  width: 42px;
  height: 42px;
  font-size: 15px;
  background: linear-gradient(135deg, var(--blue-strong), var(--cyan));
  border: 0;
}

.eyebrow {
  margin: 54px 0 12px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  font-weight: 800;
}

.login-brand h1 {
  max-width: 540px;
  margin: 0;
  font-size: 48px;
  line-height: 1.08;
  letter-spacing: 0;
}

.subtitle {
  max-width: 560px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 17px;
  line-height: 1.7;
}

.login-points {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 46px;
}

.login-points span {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.login-panel {
  padding: 34px;
}

.panel-title h2,
.card h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.panel-title p,
.card-head p,
.crumb {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.field {
  display: grid;
  gap: 9px;
  margin-top: 22px;
}

.field span {
  color: var(--sub);
  font-size: 13px;
  font-weight: 800;
}

.field input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  color: var(--text);
  outline: none;
}

.field input:focus {
  border-color: var(--blue);
  background: #fff;
}

.primary-action,
.secondary-action,
.text-action {
  height: 40px;
  border: 0;
  border-radius: 6px;
  font-weight: 900;
}

.primary-action {
  width: 100%;
  margin-top: 28px;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 10px 22px rgba(22, 140, 255, 0.22);
}

.primary-action:hover,
.secondary-action:hover,
.primary-inline:hover {
  box-shadow: 0 10px 24px rgba(22, 140, 255, 0.18);
}

.primary-action.loading,
.primary-inline.loading,
.secondary-action.loading {
  opacity: 0.72;
  pointer-events: none;
}

.secondary-action {
  padding: 0 16px;
  color: var(--blue);
  background: #edf6ff;
}

.text-action {
  padding: 0 10px;
  color: var(--sub);
  background: transparent;
}

.form-error {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--red);
  font-size: 13px;
}

.app-layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 18px;
  background: #fff;
  border-right: 1px solid var(--line);
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 22px;
  border-bottom: 1px solid var(--line);
}

.side-brand strong,
.side-brand span {
  display: block;
}

.side-brand strong {
  font-size: 16px;
}

.side-brand span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.side-nav {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}

.nav-item {
  height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--sub);
  text-align: left;
  font-weight: 800;
}

.nav-item.active,
.nav-item:hover {
  color: var(--blue);
  background: #edf6ff;
}

.section {
  animation: sectionIn 0.18s ease;
}

@keyframes sectionIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.side-footer {
  margin-top: auto;
  padding: 14px;
  border-radius: 6px;
  background: var(--soft);
}

.side-footer span,
.side-footer strong {
  display: block;
}

.side-footer span {
  color: var(--muted);
  font-size: 12px;
}

.side-footer strong {
  margin-top: 4px;
  font-size: 14px;
}

.main {
  min-width: 0;
  padding: 24px 28px 46px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.topbar h1 {
  margin: 6px 0 0;
  font-size: 30px;
  letter-spacing: 0;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 168px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.user-chip span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: #edf6ff;
  color: var(--blue);
  font-weight: 900;
}

.user-chip strong,
.user-chip em {
  display: block;
  font-style: normal;
}

.user-chip strong {
  font-size: 13px;
}

.user-chip em {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
  line-height: 1;
}

.stat-card em {
  display: block;
  margin-top: 12px;
  color: var(--sub);
  font-size: 12px;
  font-style: normal;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 18px;
}

.lower-grid {
  margin-top: 18px;
}

.card {
  padding: 22px;
  border-color: var(--line);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.card:hover {
  transform: translateY(-1px);
  box-shadow: 0 22px 48px rgba(35, 84, 140, 0.1);
}

.card.wide {
  min-height: 360px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.list {
  display: grid;
}

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

.row-side {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-button {
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: #edf6ff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.mini-button.danger {
  background: #fff0f0;
  color: var(--red);
}

.mini-button.success {
  background: #eaf8ef;
  color: var(--green);
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 150px;
}

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

.row-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 900;
}

.row-title span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-meta {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}

.money {
  color: var(--orange);
  font-weight: 900;
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 99px;
  background: #edf6ff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.pill.green {
  color: var(--green);
  background: #eaf8ef;
}

.pill.orange {
  color: var(--orange);
  background: #fff1e8;
}

.pill.red {
  color: var(--red);
  background: #fff0f0;
}

.todo-list {
  display: grid;
  gap: 10px;
}

.todo-item {
  padding: 14px;
  border-radius: 8px;
  background: var(--soft);
}

.todo-item strong {
  display: block;
  font-size: 14px;
}

.todo-item span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
}

th {
  color: var(--sub);
  background: var(--soft);
  font-weight: 900;
}

td {
  color: var(--text);
}

tr:last-child td {
  border-bottom: 0;
}

.empty {
  padding: 34px 12px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 26px;
  top: 26px;
  z-index: 60;
  max-width: 360px;
  padding: 13px 16px;
  border-radius: 8px;
  background: #15223a;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 18px 42px rgba(20, 34, 58, 0.22);
  animation: toastIn 0.18s ease;
}

.toast.success {
  background: #138a55;
}

.toast.error {
  background: #b42323;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(18, 30, 52, 0.42);
  backdrop-filter: blur(4px);
}

.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(18, 30, 52, 0.26);
  animation: modalIn 0.18s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-head,
.modal-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.modal-head {
  margin-bottom: 20px;
}

.modal-head h2 {
  margin: 0;
  font-size: 22px;
}

.modal-head p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 6px;
  background: var(--soft);
  color: var(--sub);
  font-size: 22px;
  line-height: 1;
}

.modal-fields {
  display: grid;
  gap: 16px;
}

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

.modal-field {
  display: grid;
  gap: 8px;
}

.modal-field.full {
  grid-column: 1 / -1;
}

.modal-field span {
  color: var(--sub);
  font-size: 13px;
  font-weight: 900;
}

.modal-field input,
.modal-field select,
.modal-field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  color: var(--text);
  outline: none;
}

.modal-field input,
.modal-field select {
  height: 42px;
  padding: 0 12px;
}

.modal-field textarea {
  min-height: 88px;
  padding: 11px 12px;
  resize: vertical;
}

.modal-field input:focus,
.modal-field select:focus,
.modal-field textarea:focus {
  border-color: var(--blue);
  background: #fff;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 22px;
}

.primary-inline {
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
}

.security-banner {
  grid-column: 1 / -1;
  margin-bottom: 18px;
  padding: 13px 16px;
  border: 1px solid #ffe0ad;
  border-radius: 8px;
  background: #fff8ed;
  color: #995a00;
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 1080px) {
  .login-shell,
  .app-layout,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .side-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

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

@media (max-width: 720px) {
  .login-screen,
  .main {
    padding: 18px;
  }

  .login-brand {
    min-height: 360px;
    padding: 28px;
  }

  .login-brand h1 {
    font-size: 34px;
  }

  .topbar,
  .top-actions,
  .card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .side-nav,
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
