* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f8f9fb;
  color: #111827;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* Sidebar */
.sidebar {
  width: 240px;
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-brand {
  height: 58px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #f1f5f9;
  font-weight: 600;
  font-size: 15px;
  color: #111827;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: #f3e8ff;
  color: #9333ea;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 8px 10px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 7px;
  color: #4b5563;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background 0.12s, color 0.12s;
}

.nav-link:hover {
  background: #f3f4f6;
  color: #111827;
}

.nav-link.active {
  background: #faf5ff;
  color: #9333ea;
  border: 1px solid #e9d5ff;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid #f1f5f9;
  font-size: 12px;
  color: #6b7280;
}

/* Main area */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: 58px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #6b7280;
  font-size: 13px;
}

.breadcrumb strong {
  color: #111827;
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #ffffff;
  font-size: 13px;
  font-weight: 500;
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #111827;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

.content {
  padding: 24px;
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  color: #111827;
}

.page-subtitle {
  margin: 2px 0 0;
  color: #6b7280;
  font-size: 13px;
}

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px 18px;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a855f7;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: #111827;
  margin: 8px 0 2px;
}

.stat-value.accent {
  color: #9333ea;
}

.stat-note {
  font-size: 12px;
  color: #6b7280;
}

/* Section header */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 0 14px;
  gap: 12px;
  flex-wrap: wrap;
}

.section-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Subscription cards */
.subs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.sub-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-left: 3px solid #3b82f6;
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.sub-card.expiring {
  border-left-color: #ef4444;
}

.sub-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sub-name {
  font-weight: 600;
  font-size: 14px;
  color: #111827;
  margin: 6px 0 2px;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 5px;
}

.progress-track {
  height: 5px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #3b82f6;
  border-radius: 999px;
}

.sub-card.expiring .progress-fill {
  background: #ef4444;
}

.sub-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.meta-chip {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
}

.sub-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
}

.days-big {
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.days-label {
  font-size: 10px;
  color: #6b7280;
  text-transform: uppercase;
  margin-top: 3px;
}

/* Tool cards */
.search-bar-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}

.search-input {
  width: 100%;
  max-width: 420px;
  padding: 9px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  font-size: 13px;
  outline: none;
}

.search-input:focus {
  border-color: #9333ea;
}

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

.tool-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tool-card-banner {
  height: 92px;
  background: #fafafa;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-icon-box {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #374151;
}

.tool-card-body {
  padding: 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tool-name {
  font-weight: 600;
  font-size: 14px;
  color: #111827;
}

.tool-subtitle {
  font-size: 12px;
  color: #6b7280;
}

.tool-card-footer {
  padding: 12px 16px;
  border-top: 1px solid #f1f5f9;
}

/* Badges & Buttons */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.badge-blue {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.badge-red {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.badge-gray {
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #e5e7eb;
}

.badge-purple {
  background: #faf5ff;
  color: #9333ea;
  border: 1px solid #e9d5ff;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  background: #ffffff;
  color: #111827;
  border-color: #d1d5db;
}

.btn:hover {
  background: #f9fafb;
}

.btn-dark {
  background: #111827;
  color: #ffffff;
  border-color: #111827;
  width: 100%;
  padding: 9px 14px;
}

.btn-dark:hover {
  background: #1f2937;
}

.btn-primary {
  background: #9333ea;
  color: #ffffff;
  border-color: #9333ea;
}

.btn-primary:hover {
  background: #7e22ce;
}

.btn-danger {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* Panels & Tables (aMember classic style) */
.panel {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  margin-bottom: 20px;
  overflow: hidden;
}

.panel-header {
  padding: 14px 18px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.panel-body {
  padding: 18px;
}

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

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data-table th {
  text-align: left;
  padding: 10px 14px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  font-weight: 600;
  font-size: 12px;
  color: #4b5563;
  white-space: nowrap;
}

table.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

table.data-table tr:hover td {
  background: #fafafa;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

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

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  font-size: 13px;
  background: #ffffff;
  color: #111827;
}

.form-control:focus {
  outline: none;
  border-color: #9333ea;
}

.alert {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  border: 1px solid transparent;
}

.alert-success {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

/* Login box */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #f3f4f6;
}

.login-card {
  width: 100%;
  max-width: 390px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 28px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

@media (max-width: 820px) {
  .app-shell {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
  }
}
