@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=DM+Serif+Display&display=swap');

/* iPad — scale login form text up */
@media (min-width: 768px) and (max-width: 1366px) {
  .login-form-wrap h2         { font-size: 43px; }
  .login-form-wrap .subtitle  { font-size: 21px; }
  .form-group label           { font-size: 20px; }
  .form-group input           { font-size: 21px; }
  .btn-primary                { font-size: 23px; }
  .login-footer               { font-size: 18px; }
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f5f3ee;
  --white: #ffffff;
  --ink: #1a1a18;
  --ink-muted: #6b6b65;
  --border: #e2e0d8;
  --sidebar-bg: #1a1a18;
  --sidebar-text: rgba(255, 255, 255, 0.7);
  --accent: #2d5be3;
  --radius: 12px;
  --shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

h1, h2, h3 {
  font-family: 'DM Serif Display', serif;
}

/* ── Login Page ── */

.login-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

.login-left {
  background: var(--sidebar-bg);
  color: var(--white);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px;
}

.login-left-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
}

.login-brand-mark {
  width: 52px;
  height: 52px;
  background: var(--accent);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  color: white;
  font-weight: bold;
  margin-bottom: 8px;
}

.login-left h1 {
  font-size: 36px;
  line-height: 1.2;
  color: var(--white);
}

.login-left p {
  color: var(--sidebar-text);
  font-size: 16px;
  line-height: 1.6;
  max-width: 320px;
}

.trusted-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
  width: fit-content;
}

.trusted-dots {
  display: flex;
  gap: 4px;
}

.trusted-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--sidebar-bg);
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
}

.trusted-dot:nth-child(1) { background: #2d5be3; margin-left: 0; }
.trusted-dot:nth-child(2) { background: #e3852d; margin-left: -6px; }
.trusted-dot:nth-child(3) { background: #2db38d; margin-left: -6px; }

.login-left-footer {
  color: rgba(255, 255, 255, 0.35);
  font-size: 12px;
}

.login-right {
  background: var(--white);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 48px;
}

.login-form-wrap {
  width: 100%;
  max-width: 360px;
}

.login-form-wrap h2 {
  font-size: 28px;
  margin-bottom: 6px;
  color: var(--ink);
}

.login-form-wrap .subtitle {
  color: var(--ink-muted);
  font-size: 14px;
  margin-bottom: 32px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--white);
  transition: border-color 0.15s;
  outline: none;
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
  margin-top: 8px;
}

.btn-primary:hover {
  opacity: 0.88;
}

.error-message {
  display: none;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}

.login-footer {
  margin-top: 32px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-muted);
}

/* ── App Layout ── */

.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Top Bar ── */

.topbar {
  background: var(--sidebar-bg);
  display: flex;
  align-items: center;
  padding: 0 14px;
  height: 50px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  gap: 6px;
}

.topbar::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(to bottom, rgba(26, 26, 24, 0.18), transparent);
  pointer-events: none;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 12px;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
}

.logo-mark {
  width: 24px;
  height: 24px;
  background: var(--accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.company-name {
  font-size: 12px;
  font-weight: 600;
  color: white;
  white-space: nowrap;
}

.sidebar-username {
  display: block;
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  white-space: nowrap;
}
.sidebar-username--ipad {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.01em;
}

.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.14);
  color: white;
}

.nav-item.active {
  background: var(--accent);
  color: white;
}

.nav-item.disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* ── Nav group dropdown ──────────────────────────────── */
.nav-group {
  position: relative;
}
.nav-group-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--sidebar-text);
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.nav-group-btn:hover,
.nav-group.open .nav-group-btn,
.nav-group-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}
.nav-group-arrow {
  font-size: 8px;
  opacity: 0.5;
  transition: transform 0.15s;
}
.nav-group.open .nav-group-arrow {
  transform: rotate(180deg);
  opacity: 0.8;
}
.nav-group-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #2a2a28;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 6px;
  min-width: 160px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 300;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.nav-group.open .nav-group-menu {
  display: flex;
}
.nav-group-menu .nav-item {
  border-radius: 6px;
  padding: 6px 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
}
.nav-group-menu .nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
}
.nav-group-menu .nav-item.active {
  background: var(--accent);
  color: white;
}

.nav-icon {
  width: 16px;
  height: 16px;
  opacity: 0.7;
  flex-shrink: 0;
}

.logout-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: var(--sidebar-text);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  padding: 4px 12px;
  cursor: pointer;
  touch-action: manipulation;
  text-align: center;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: white;
}

/* Settings button — sits beside Sign Out in topbar */
.settings-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: var(--sidebar-text);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  padding: 4px 12px;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
  display: inline-block;
}
.settings-btn:hover { background: rgba(255,255,255,0.06); color: white; }
.settings-btn.disabled { opacity: 0.35; pointer-events: none; }
.settings-btn.active { color: white; border-color: rgba(255,255,255,0.35); }

/* Demo company indicator badge in topbar */
.demo-badge {
  background: #f59e0b;
  color: #1a1a18;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 4px;
  flex-shrink: 0;
  pointer-events: none;
  user-select: none;
}

/* Groups Settings + Sign Out on the right of the topbar */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}


/* ── Main Content ── */

.main-content {
  padding: 32px 40px;
  padding-top: calc(50px + 32px); /* topbar height + spacing */
  flex: 1;
}

.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 28px;
  color: var(--ink);
  margin-bottom: 4px;
}

.page-header p {
  color: var(--ink-muted);
  font-size: 14px;
}

/* ── Cards ── */

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 20px 24px 0;
}

.card-title {
  font-size: 16px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  color: var(--ink);
}

.card-body {
  padding: 16px 24px 24px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}


/* ── Status Badge ── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.badge--active {
  background: #dcfce7;
  color: #15803d;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ── Stat Row ── */

.stat-row {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  flex: 1;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-family: 'DM Serif Display', serif;
  color: var(--ink);
  line-height: 1;
}

.stat-sub {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 4px;
}

/* ── Table ── */

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: var(--bg);
}

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.status-pill--green { background: #dcfce7; color: #15803d; }
.status-pill--yellow { background: #fef9c3; color: #854d0e; }
.status-pill--blue { background: #dbeafe; color: #1d4ed8; }
.status-pill--grey { background: #f3f4f6; color: #6b7280; }

/* ── Tab Bar ── */

.tab-bar {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.tab {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  text-decoration: none;
}

.tab:hover {
  color: var(--ink);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}


.btn-accent {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.btn-accent:hover {
  opacity: 0.88;
}

.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.btn-ghost:hover {
  border-color: var(--ink-muted);
  color: var(--ink);
}


/* ── Chart Placeholder ── */

.chart-placeholder {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 8px;
  height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink-muted);
  font-size: 13px;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 60px;
}

.chart-bar {
  width: 18px;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  opacity: 0.3;
}

@media (max-width: 768px) {
  .login-page {
    grid-template-columns: 1fr;
  }
  .login-left {
    display: none;
  }
  .topbar {
    padding: 0 10px;
    height: 36px;
  }
  .topbar-brand {
    padding-right: 10px;
  }
  .company-name {
    display: none;
  }
  .sidebar-username {
    display: none;
  }
  .main-content {
    padding: 20px 16px;
  }
  .stat-row {
    flex-wrap: wrap;
  }
}
