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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f6f8;
  color: #333;
  line-height: 1.5;
}

header {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header h1 {
  font-size: 18px;
  color: #1a1a1a;
}

nav {
  display: flex;
  gap: 4px;
}

.nav-tab {
  padding: 6px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  color: #666;
  transition: background 0.15s, color 0.15s;
}

.nav-tab:hover {
  background: #f0f1f3;
  color: #333;
}

.nav-tab.active {
  background: #0d6efd;
  color: #fff;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 16px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

/* Cards */
.card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
}

.card-subtitle {
  font-size: 12px;
  color: #888;
}

.card-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

.card-actions {
  display: flex;
  gap: 6px;
}

/* Buttons */
button {
  padding: 7px 14px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}

.btn-primary {
  background: #0d6efd;
  color: #fff;
}

.btn-primary:hover {
  background: #0b5ed7;
}

.btn-primary:disabled {
  background: #6c9cee;
  cursor: not-allowed;
}

.btn-secondary {
  background: #e9ecef;
  color: #333;
}

.btn-secondary:hover {
  background: #dee2e6;
}

.btn-danger {
  background: #dc3545;
  color: #fff;
}

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

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

.btn-icon {
  padding: 4px 8px;
  background: none;
  color: #666;
  font-size: 14px;
}

.btn-icon:hover {
  background: #f0f1f3;
}

/* Forms */
.form-group {
  margin-bottom: 12px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
  color: #444;
}

input[type="text"],
input[type="password"],
select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.15s;
}

input:focus,
select:focus {
  outline: none;
  border-color: #0d6efd;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.form-hint {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

/* Tags */
.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.tag-plan {
  background: #e7f5ff;
  color: #1971c2;
}

.tag-managed {
  background: #fff3bf;
  color: #946200;
}

.tag-pass {
  background: #d3f9d8;
  color: #2b8a3e;
}

.tag-warn {
  background: #ffe3e3;
  color: #c92a2a;
}

/* Credential expiry */
.expiry-ok { background: #d3f9d8; color: #2b8a3e; }
.expiry-warning { background: #fff3bf; color: #946200; }
.expiry-soon { background: #ffe3e3; color: #c92a2a; }
.expiry-expired { background: #c92a2a; color: #fff; }

/* Auth toggle */
.auth-toggle {
  display: flex;
  gap: 16px;
  margin-top: 4px;
}

.auth-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}

.auth-section {
  padding-left: 4px;
  border-left: 3px solid #e0e0e0;
  margin-bottom: 12px;
  padding-bottom: 4px;
}

/* Addon rows */
.addon-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  cursor: pointer;
}

.addon-row input[type="checkbox"] {
  accent-color: #0d6efd;
}

.addon-row input:disabled + span {
  color: #888;
}

/* Managed tenant list */
.managed-list {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #eee;
}

.managed-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  margin: 4px 0;
  background: #f8f9fa;
  border-radius: 6px;
  font-size: 13px;
}

.managed-info {
  flex: 1;
  min-width: 0;
}

.managed-name {
  font-weight: 500;
}

.managed-id {
  color: #888;
  font-size: 11px;
  margin-left: 8px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #888;
}

.empty-state p {
  font-size: 14px;
  margin-bottom: 16px;
}

/* Progress */
.progress-container {
  margin: 16px 0;
}

.progress-bar {
  height: 6px;
  background: #e9ecef;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: #0d6efd;
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  font-size: 12px;
  color: #666;
}

/* Summary stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  text-align: center;
  padding: 16px 12px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
  margin-top: 2px;
}

.stat-pass .stat-value { color: #2b8a3e; }
.stat-warn .stat-value { color: #c92a2a; }
.stat-pct .stat-value { color: #0d6efd; }
.stat-quota-notice .stat-value { color: #fd7e14; }

/* Namespace selection */
.ns-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px;
  margin: 12px 0;
  max-height: 300px;
  overflow-y: auto;
  padding: 4px;
}

.ns-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s;
}

.ns-item:hover {
  background: #f8f9fa;
}

.ns-item input[type="checkbox"] {
  accent-color: #0d6efd;
}

/* Report iframe */
.report-frame {
  width: 100%;
  height: 80vh;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fff;
}

.report-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}

/* Alert */
.alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 12px;
}

.alert-error {
  background: #ffe3e3;
  color: #c92a2a;
  border: 1px solid #ffc9c9;
}

.alert-success {
  background: #d3f9d8;
  color: #2b8a3e;
  border: 1px solid #b2f2bb;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #e0e0e0;
  border-top-color: #0d6efd;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Log */
.audit-log {
  margin-top: 12px;
  padding: 12px;
  background: #1a1a2e;
  color: #a0d8ef;
  border-radius: 8px;
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 12px;
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.6;
}

.audit-log .log-entry {
  padding: 1px 0;
}

.audit-log .log-time {
  color: #666;
  margin-right: 8px;
}

/* User badge */
#user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

#user-badge:empty {
  display: none;
}

.user-name {
  color: #666;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Unlock card */
.unlock-card {
  max-width: 400px;
  margin: 60px auto;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 32px;
}

.unlock-title {
  font-size: 20px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 8px;
}

.unlock-desc {
  font-size: 13px;
  color: #666;
  margin-bottom: 24px;
  line-height: 1.5;
}
