:root {
  --navy: #1A1B3A;
  --navy-light: #262850;
  --purple-deep: #4F5BD5;
  --purple-light: #9AA5FF;
  --off-white: #E8EAF3;
  --soft-gray: #F4F5FB;
  --white: #FFFFFF;
  --red: #C0212A;
  --red-deep: #8E1820;
  --yellow: #FFD93D;
  --success: #4CD99E;
  --warning: #E85A6B;
  --ink: #1A1A1A;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--soft-gray);
  color: var(--ink);
}

h1, h2, h3, .wordmark {
  font-family: 'Poppins', sans-serif;
}

a { color: var(--purple-deep); }

/* ---------- Login page ---------- */

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #9AA5FF 0%, #4F5BD5 55%, #1A1B3A 100%);
  padding: 24px;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(26, 27, 58, 0.35);
  text-align: center;
}

.login-card .accent-bar {
  height: 6px;
  width: 64px;
  margin: 0 auto 20px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--red) 0%, var(--yellow) 55%, var(--purple-deep) 100%);
}

.login-card h1 {
  font-size: 22px;
  margin: 0 0 6px;
  color: var(--navy);
}

.login-card p.sub {
  color: #6b6f95;
  font-size: 14px;
  margin: 0 0 28px;
}

.login-card input[type="email"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #d8dcf0;
  font-size: 15px;
  font-family: inherit;
  margin-bottom: 14px;
}

.login-card button {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: none;
  background: var(--purple-deep);
  color: white;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
}

.login-card button:hover { background: #3f4bc0; }

.login-msg {
  margin-top: 16px;
  font-size: 13px;
  min-height: 18px;
}

.login-msg.ok { color: #1d9d6c; }
.login-msg.err { color: var(--red); }

/* ---------- App shell ---------- */

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

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--navy);
  color: var(--off-white);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
}

.sidebar .brand {
  padding: 0 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 16px;
}

.sidebar .brand .accent-bar {
  height: 4px;
  width: 40px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--red), var(--yellow), var(--purple-light));
  margin-bottom: 12px;
}

.sidebar .brand h1 {
  font-size: 17px;
  line-height: 1.3;
  margin: 0;
  color: white;
}

.sidebar .brand .subtitle {
  font-size: 12px;
  color: var(--purple-light);
  margin-top: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  cursor: pointer;
  font-size: 14px;
  color: var(--off-white);
  border-left: 3px solid transparent;
  opacity: 0.85;
}

.nav-item .ico { font-size: 16px; width: 20px; text-align: center; }

.nav-item:hover { background: rgba(255,255,255,0.05); opacity: 1; }

.nav-item.active {
  background: rgba(255,255,255,0.08);
  border-left-color: var(--red);
  opacity: 1;
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: var(--purple-light);
}

.sidebar-footer button {
  margin-top: 8px;
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--off-white);
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
}

.sidebar-footer button:hover { background: rgba(255,255,255,0.1); }

.main {
  flex: 1;
  padding: 32px 40px;
  max-width: 1400px;
  min-width: 0;
}

.main h2.page-title {
  font-size: 24px;
  margin: 0 0 4px;
  color: var(--navy);
}

.main p.page-sub {
  color: #6b6f95;
  margin: 0 0 28px;
  font-size: 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 2px 10px rgba(26,27,58,0.06);
  border: 1px solid #eceefa;
}

.card h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card p.desc {
  color: #6b6f95;
  font-size: 13px;
  margin: 0 0 16px;
  min-height: 32px;
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--yellow);
  color: #4a3b00;
  margin-left: 6px;
}

.badge.missing {
  background: var(--warning);
  color: white;
}

.btn {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 9px;
  border: none;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  text-align: center;
}

.btn-primary { background: var(--red); color: white; }
.btn-primary:hover { background: var(--red-deep); }

.btn-secondary { background: var(--soft-gray); color: var(--navy); border: 1px solid #dfe2f5; }
.btn-secondary:hover { background: #ecefff; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.file-meta {
  font-size: 12px;
  color: #8489ab;
  margin-bottom: 14px;
}

.hidden { display: none !important; }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(26,27,58,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}

.modal {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 420px;
}

.modal h3 { margin-top: 0; }

.modal input, .modal textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #d8dcf0;
  font-family: inherit;
  font-size: 14px;
  margin-bottom: 12px;
}

.modal .modal-actions {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px;
}

.file-meta-card {
  max-width: 520px;
  padding: 16px 22px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.file-meta-card .file-meta-info h3 { margin: 0 0 4px; font-size: 15px; }
.file-meta-card .file-meta-info p { margin: 0; font-size: 12px; color: #8489ab; }

.sheet-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.sheet-tab {
  padding: 7px 14px;
  border-radius: 20px;
  background: var(--white);
  border: 1px solid #dfe2f5;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
}

.sheet-tab.active {
  background: var(--purple-deep);
  color: white;
  border-color: var(--purple-deep);
}

.preview-note {
  font-size: 12px;
  color: #8489ab;
  margin: 0 0 12px;
}

.preview-wrap {
  background: white;
  border-radius: var(--radius);
  border: 1px solid #eceefa;
  overflow: auto;
  max-height: 620px;
  box-shadow: 0 2px 10px rgba(26,27,58,0.06);
}

table.preview-table {
  border-collapse: collapse;
  font-size: 12px;
  white-space: nowrap;
}

table.preview-table td {
  padding: 5px 9px;
  border: 1px solid #eef0f8;
}

table.preview-table td.bold { font-weight: 700; }

.preview-empty {
  padding: 24px;
  color: #8489ab;
  font-size: 13px;
}

table.team-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(26,27,58,0.06);
}

table.team-table th, table.team-table td {
  text-align: left;
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid #eceefa;
}

table.team-table th { background: var(--soft-gray); color: var(--navy); }

.invite-row {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.invite-row input { padding: 10px 12px; border-radius: 8px; border: 1px solid #d8dcf0; font-family: inherit; }

.remove-link { color: var(--red); font-size: 12px; cursor: pointer; }

@media (max-width: 760px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; overflow-x: auto; padding: 12px; }
  .sidebar .brand { display: none; }
  .sidebar-footer { display: none; }
  .main { padding: 20px; }
}
