:root {
  --orange: #ff8c00;
  --orange-light: #fff4e6;
  --bg: #f8f9fa;
  --card: #ffffff;
  --text: #333333;
  --muted: #666666;
  --border: #e0e0e0;
  --success: #28a745;
  --danger: #dc3545;
  --radius: 12px;
  --shadow: 0 4px 16px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 16px;
  top: 16px;
  background: #000;
  color: #fff;
  padding: 8px 12px;
  z-index: 100;
}

.portal-header {
  background: linear-gradient(135deg, var(--orange), #ffa500);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.portal-brand .logo { font-weight: 800; font-size: 20px; }
.portal-brand .tag { opacity: 0.85; font-size: 13px; margin-left: 8px; }

.nav-toggle {
  display: none;
  background: rgba(255,255,255,0.2);
  border: 0;
  color: #fff;
  font-size: 22px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.portal-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 60px);
}

.portal-nav {
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: calc(100vh - 60px);
}

.nav-item {
  display: block;
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
}
.nav-item:hover { background: var(--orange-light); }
.nav-item.active {
  background: var(--orange);
  color: #fff;
}

.nav-item-download {
  background: linear-gradient(135deg, #111, #333);
  color: #fff !important;
  font-weight: 600;
  margin-top: 4px;
}
.nav-item-download:hover {
  background: linear-gradient(135deg, #222, #444);
  color: #fff !important;
}
.nav-item-download.active {
  background: var(--orange);
}
.nav-item-icon {
  margin-right: 6px;
}
.nav-item:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.portal-main {
  padding: 24px 20px 48px;
  max-width: 960px;
}

.page-title {
  margin: 0 0 20px;
  font-size: 26px;
  font-weight: 700;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
}
.stat-label { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--orange); }

.btn {
  display: inline-block;
  padding: 12px 18px;
  background: var(--orange);
  color: #fff;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  border: 0;
  cursor: pointer;
  font-size: 15px;
  min-height: 48px;
}
.btn:focus-visible { outline: 2px solid #000; outline-offset: 2px; }
.btn-secondary { background: #fff; color: var(--orange); border: 1px solid var(--orange); }

.muted { color: var(--muted); font-size: 14px; }
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger { background: #f8d7da; color: #721c24; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.data-table th, table.data-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
table.data-table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.form-group input, .form-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
}

.login-wrap {
  max-width: 400px;
  margin: 48px auto;
  padding: 0 16px;
}

.nav-app-download {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.nav-app-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 10px 4px;
}

.app-store-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 10px;
  background: #111;
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: opacity 0.2s;
}

.app-store-btn:hover {
  opacity: 0.88;
  color: #fff;
}

.download-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.download-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s, box-shadow 0.15s;
}

.download-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  color: var(--text);
}

.download-card small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.download-card strong {
  display: block;
  font-size: 18px;
  margin-top: 2px;
}

.download-card-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: #111;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.download-features {
  margin: 0;
  padding-left: 20px;
  line-height: 1.9;
  color: var(--muted);
}

@media (max-width: 768px) {
  .portal-shell { grid-template-columns: 1fr; }
  .portal-nav {
    display: none;
    position: fixed;
    inset: 60px 0 auto 0;
    z-index: 50;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    box-shadow: var(--shadow);
  }
  body.nav-open .portal-nav { display: flex; }
  .nav-toggle { display: block; }
}
