
:root {
  font-family: Inter, ui-sans-serif, system-ui,
    -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
  --bg: #090b10;
  --surface: #15181f;
  --surface2: #1b1f28;
  --text: #f7f9ff;
  --muted: #a7afbd;
  --border: #303541;
  --accent: #3183ff;
  --nav: #101218;
  --blue1: #0751d1;
  --blue2: #2781f5;
  --blue3: #9edaff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  transition: background .25s, color .25s;
}

button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

/* LOGIN PAGE */

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 25px;
  background:
    radial-gradient(
      ellipse at 15% 20%,
      #173d72 0%,
      transparent 42%
    ),
    radial-gradient(
      ellipse at 85% 85%,
      #071d4a 0%,
      transparent 45%
    ),
    #090b10;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 42px 34px 38px;
  border-radius: 24px;
  background: #15181f;
  border: 1px solid #303541;
  text-align: center;
  box-shadow: 0 25px 70px #00000035;
  color: #f7f9ff;
}

.login-logo {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 25px;
  border-radius: 21px;
  background: linear-gradient(135deg, #0751d1, #67baff);
  color: white;
  font-size: 26px;
  font-weight: 900;
}

.login-card h2 {
  margin: 0 0 12px;
  font-size: 29px;
  letter-spacing: .035em;
}

.login-subtitle {
  margin: 0 0 38px;
  color: #a7afbd;
  font-size: 13px;
}

#login-form {
  display: grid;
  gap: 11px;
  text-align: left;
}

#login-form label {
  color: #a7afbd;
  font-size: 12px;
  font-weight: 600;
}

#login-form input {
  width: 100%;
  padding: 15px;
  margin-bottom: 15px;
  border-radius: 12px;
  border: 1px solid #303541;
  background: #1b1f28;
  color: white;
  outline: none;
}

#login-form input:focus {
  border-color: #3183ff;
  box-shadow: 0 0 0 3px #3183ff25;
}

#login-btn {
  width: 100%;
  padding: 15px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #0751d1, #3183ff);
  color: white;
  font-weight: 700;
}

#login-btn:disabled {
  opacity: .65;
  cursor: wait;
}

#login-error {
  min-height: 17px;
  color: #ff8d9c;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.login-footer {
  margin: 36px 0 12px;
  color: #a7afbd;
  font-size: 12px;
}

.login-card small {
  color: #a7afbd;
  font-size: 11px;
}

/* APP LAYOUT */

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

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--nav);
  border-right: 1px solid var(--border);
  padding: 26px 16px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  background: linear-gradient(135deg, var(--blue1), var(--blue3));
  color: white;
  border-radius: 14px;
  font-weight: 900;
}

.brand strong {
  display: block;
  font-size: 13px;
  letter-spacing: .04em;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .16em;
  margin-top: 4px;
}

.sidebar nav {
  display: grid;
  gap: 9px;
}

.nav {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 13px 15px;
  border-radius: 13px;
}

.nav:hover,
.nav.active {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text);
}

.nav.active {
  box-shadow: inset 3px 0 var(--accent);
}

.sidebar-note {
  margin-top: auto;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.7;
}

#user-info {
  color: var(--accent);
  overflow-wrap: anywhere;
}

.logout-btn {
  width: 100%;
  margin-top: 15px;
  padding: 13px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-weight: 700;
}

.logout-btn:hover {
  border-color: var(--accent);
}

.main {
  width: 100%;
  max-width: 1500px;
  margin: auto;
  padding: 30px 38px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-bottom: 25px;
}

.eyebrow {
  font-size: 10px;
  letter-spacing: .18em;
  color: var(--accent);
  font-weight: 800;
}

h1 {
  font-size: 30px;
  margin: 7px 0;
}

h2 {
  font-size: 34px;
  line-height: 1.15;
  margin: 12px 0;
}

h3 {
  font-size: 17px;
  margin: 0;
}

.theme-toggle {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 18px;
  border-radius: 25px;
  white-space: nowrap;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

/* HERO */

.hero {
  background: linear-gradient(
    115deg,
    #0d1a30,
    #173e80 58%,
    #2669bf
  );
  border: 1px solid #3864a6;
  border-radius: 23px;
  padding: 29px 34px;
  margin-bottom: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
}

.hero .eyebrow { color: #b6d6ff; }
.hero em { font-style: normal; color: #a6d7ff; }
.hero p:not(.eyebrow) { color: #d4e5ff; }
.hero-icon { font-size: 70px; color: #b4d6ff; }

/* STATISTICS */

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.stat {
  min-height: 145px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  background: linear-gradient(
    145deg,
    #9edaff 0%,
    #368eff 43%,
    #0751d1 100%
  );
  border: 1px solid #7ebaff;
  border-radius: 17px;
  padding: 21px;
  color: #fff;
  box-shadow: 0 7px 22px #00000012;
}

.stat span,
.stat small {
  color: #fff;
  font-size: 12px;
}

.stat strong { font-size: 27px; }
.stat small { opacity: .9; }

/* PANELS */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 19px;
  padding: 23px;
  margin-bottom: 19px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 19px;
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
}

/* ANALYTICS */

.analytics {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 18px;
}

.chart-panel { min-width: 0; }

.chart-caption {
  font-size: 12px;
  color: var(--muted);
}

.chart-area {
  height: 245px;
  padding: 15px 12px 0;
  background: repeating-linear-gradient(
    to top,
    transparent 0,
    transparent calc(25% - 1px),
    var(--border) 25%
  );
  border-bottom: 1px solid var(--border);
}

.chart-bars {
  display: flex;
  align-items: end;
  justify-content: space-around;
  height: 100%;
  gap: 12px;
}

.bar-group {
  display: flex;
  flex-direction: column;
  justify-content: end;
  align-items: center;
  height: 100%;
  flex: 1;
  gap: 8px;
}

.bar {
  width: min(45px, 100%);
  height: var(--h);
  min-height: 8px;
  border-radius: 9px 9px 3px 3px;
  background: linear-gradient(
    to top,
    #0751d1,
    #2781f5 55%,
    #9edaff
  );
  transition: filter .2s, transform .2s;
}

.bar:hover {
  filter: brightness(1.15);
  transform: translateY(-3px);
}

.bar-group small {
  font-size: 11px;
  color: var(--muted);
}

.donut {
  height: 188px;
  width: 188px;
  max-width: 100%;
  margin: 20px auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(
    #93d8ff 0%,
    #398eff 38%,
    #0751d1 67%,
    var(--surface2) 67% 100%
  );
}

.donut-center {
  height: 130px;
  width: 130px;
  background: var(--surface);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.donut-center strong { font-size: 30px; }

.donut-center small {
  font-size: 11px;
  color: var(--muted);
}

/* TABLES */

.table-wrap { overflow: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  white-space: nowrap;
}

th, td {
  padding: 15px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.pill {
  display: inline-block;
  padding: 7px 10px;
  border-radius: 30px;
  font-size: 11px;
  background: #183d70;
  color: #9edaff;
}

.pill.yellow {
  background: #5d4319;
  color: #ffdf91;
}

.pill.green {
  background: #153c32;
  color: #8ef0c5;
}

.pill.purple {
  background: #342548;
  color: #d9b4ff;
}

.muted {
  color: var(--muted);
  line-height: 1.6;
}

/* CLIENT LIST */

.client-list {
  display: grid;
  gap: 13px;
}

.client {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface2);
}

.client p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.initial {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #0751d1, #9edaff);
  border-radius: 50%;
  font-weight: bold;
  color: white;
}

/* ADD CLIENT FORM */

.client-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.client-form label {
  display: flex;
  flex-direction: column;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.client-form input {
  width: 100%;
  padding: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text);
  outline: none;
}

.client-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #3183ff26;
}

.client-form input::placeholder {
  color: var(--muted);
}

#create-client-btn {
  grid-column: 1 / -1;
  padding: 15px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #0751d1, #3183ff);
  color: white;
  font-weight: 700;
}

#create-client-btn:hover { filter: brightness(1.1); }

#create-client-btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}

#create-client-message {
  margin-top: 16px;
  overflow-wrap: anywhere;
}

#clients-status { font-size: 13px; }
#real-client-list { margin-top: 15px; }

/* PAYMENT CALCULATOR */

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

.calculator label {
  display: grid;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}

.calculator input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 14px;
  border-radius: 11px;
}

.balance {
  padding: 17px;
  background: linear-gradient(135deg, #0751d1, #439aff);
  border-radius: 13px;
  color: white;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.balance strong { font-size: 24px; }

footer {
  color: var(--muted);
  font-size: 11px;
  padding: 22px 0;
  text-align: center;
}

/* LIGHT THEME */

[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fa;
  --surface: #fff;
  --surface2: #f6f8fc;
  --text: #131821;
  --muted: #616b7a;
  --border: #e1e5eb;
  --accent: #1765d8;
  --nav: #fff;
}

/* RESPONSIVE */

@media (max-width: 900px) {
  .sidebar { width: 190px; }
  .main { padding: 25px 20px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .analytics { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .shell { display: block; }

  .sidebar {
    width: 100%;
    padding: 15px;
    gap: 15px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .sidebar nav {
    display: flex;
    overflow: auto;
    gap: 5px;
  }

  .nav {
    white-space: nowrap;
    padding: 10px;
  }

  .sidebar-note { margin-top: 0; }
  .main { padding: 18px 13px; }
  .hero { padding: 20px; }
  .hero h2 { font-size: 26px; }
  .hero-icon { display: none; }
  .stats { gap: 9px; }

  .stat {
    padding: 15px;
    min-height: 125px;
  }

  .stat strong { font-size: 22px; }
  .panel { padding: 16px; }
  .calculator { grid-template-columns: 1fr; }
  .client-form { grid-template-columns: 1fr; }
  .chart-area { height: 205px; }
  .login-card { padding: 34px 22px; }
}
