:root {
  --bg: #ffffff;
  --text: #000000;
  --text-muted: #555555;
  --border: #000000;
  --surface: #ffffff;
  --accent: #000000;
  --accent-text: #ffffff;
  --highlight: #f0f0f0;

  --font-mono: "JetBrains Mono", "SF Mono", "Menlo", "Consolas", monospace;
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  padding: 24px !important;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Headings & Typography */
h1, h2, h3 {
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.02em;
}

p {
  margin: 0 0 1rem 0;
}

.subtle {
  color: var(--text-muted);
  font-size: 13px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

.hidden {
  display: none !important;
}

/* Layout */
main.admin-shell {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Surface / Panels */
.surface {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 24px;
  margin-bottom: 20px;
}

/* Forms & Inputs */
input {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 0;
  width: 100%;
}

input:focus {
  outline: 2px solid var(--text);
  outline-offset: -1px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field span, .meta-label, .created-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

/* Buttons */
button, .btn {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  border-radius: 0;
  transition: all 0.1s ease;
  white-space: nowrap;
}

button:hover, .btn:hover {
  background: var(--text);
  color: var(--surface);
}

button:disabled, .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.btn.primary {
  background: var(--accent);
  color: var(--accent-text);
}

.btn.primary:hover {
  background: var(--surface);
  color: var(--accent);
}

/* Login View */
.login-view {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-panel {
  width: 100%;
  max-width: 440px;
}

.login-mark {
  font-family: var(--font-mono);
  font-size: 12px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-mark-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  font-weight: bold;
  background: var(--text);
  color: var(--surface);
}

.login-form {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#loginButton {
  width: 100%;
  margin-top: 8px;
}

/* Dashboard Header */
.dashboard-view {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px dotted var(--border);
  padding-bottom: 24px;
}

.title-block h1 {
  font-size: 24px;
}

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

.session-chip {
  font-family: var(--font-mono);
  font-size: 10px;
  border: 1px solid var(--border);
  padding: 2px 8px;
  text-transform: uppercase;
}

.toolbar {
  display: flex;
  gap: 12px;
}

.search-field {
  margin-bottom: 0;
}

.search-field input {
  min-width: 300px;
}

/* Create Form */
.header-bottom {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.summary-line {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.create-form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.create-form .field {
  margin-bottom: 0;
}

.owner-field input { width: 300px; }
.compact-number input { width: 100px; }
.checkbox-field { flex-direction: row; align-items: center; gap: 8px; }
.checkbox-field input[type="checkbox"] { width: 16px; height: 16px; margin: 0; cursor: pointer; }

.create-feedback-row {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 36px;
}

.created-license {
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--border);
  padding: 8px 12px;
  background: var(--highlight);
}

.created-key-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

#createdLicenseKey {
  font-family: var(--font-mono);
  font-weight: bold;
}

/* List Panel */
.list-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
  border-top: 2px solid var(--border);
  border-bottom: 2px solid var(--border);
  border-left: 0;
  border-right: 0;
  margin-bottom: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--highlight);
}

.panel-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.license-list {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.license-row {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.license-row:last-child {
  border-bottom: none;
}

.license-main {
  display: grid;
  grid-template-columns: 2fr 2.5fr 1fr 1fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.license-controls {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1.5fr auto;
  gap: 20px;
  padding-top: 20px;
  border-top: 1px dotted var(--border);
}

.meta-value {
  font-family: var(--font-mono);
  font-size: 13px;
  margin-top: 4px;
}

.meta-subvalue {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.key-copy {
  width: 100%;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
}

.key-copy:hover {
  background: var(--border);
  color: var(--surface);
}

/* Badges */
.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  padding: 4px 8px;
  border: 1px solid currentColor;
  font-weight: bold;
}

.badge-active { color: #000; background: #fff; border: 1px solid #000; }
.badge-active::before { content: "● "; color: #000; }

.badge-revoked { color: #fff; background: #000; border: 1px solid #000; }
.badge-revoked::before { content: "✕ "; }

.badge-expired { color: #555; background: #eee; border: 1px solid #555; }
.badge-expired::before { content: "○ "; }

.badge-unused { color: #000; background: #fff; border: 1px dashed #000; }
.badge-unused::before { content: "- "; }

/* Mini forms */
.mini-form {
  display: flex;
  gap: 8px;
}

.mini-input {
  min-width: 60px;
  padding: 6px 8px;
}

.mini-button, .danger-button {
  padding: 6px 12px;
  font-size: 11px;
}

.action-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.danger-button {
  background: #fff;
  color: #000;
  border: 1px dashed #000;
}
.danger-button:hover {
  background: #000;
  color: #fff;
  border-style: solid;
}

/* Feedbacks */
.inline-feedback {
  font-family: var(--font-mono);
  font-size: 12px;
  margin-top: 8px;
}
.inline-feedback.is-error { color: #d00; }
.inline-feedback.is-success { color: #080; }

/* Empty State */
.empty-state {
  padding: 60px 24px;
  text-align: center;
}

.empty-state h2 {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 18px;
}

/* Toast Stack */
.toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 999;
}

.toast {
  padding: 16px 20px;
  background: #fff;
  border: 2px solid #000;
  font-family: var(--font-mono);
  font-size: 12px;
  box-shadow: 4px 4px 0 #000;
  animation: slideIn 0.2s ease-out;
}

.toast.is-success { border-left: 6px solid #000; }
.toast.is-error { border-left: 6px solid #d00; }

@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Tab Navigation */
.tab-nav {
  display: flex;
  margin: 0 -24px -24px;
  border-top: 1px solid var(--border);
  overflow: hidden;
}

.tab-btn {
  padding: 14px 24px;
  border: none;
  border-right: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  background: var(--highlight);
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 0;
  transition: all 0.1s;
}

.tab-btn:hover {
  background: var(--text);
  color: var(--surface);
}

.tab-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 -3px 0 var(--text);
}

/* Tab section header */
.tab-header {
  padding: 20px 24px;
  margin-bottom: 0;
}

/* Review entries */
.review-list {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.review-entry {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.review-entry:last-child {
  border-bottom: none;
}

.review-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.review-stars {
  font-size: 20px;
  letter-spacing: 3px;
  color: var(--text);
  line-height: 1;
}

.review-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.review-text {
  margin: 8px 0 6px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

.review-meta-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 4px;
}

.review-version {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.review-owner {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Responsiveness */
@media (max-width: 1200px) {
  .license-main {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .license-controls {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .header-top {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar {
    flex-direction: column;
  }
  .create-form {
    flex-direction: column;
    align-items: stretch;
  }
  .owner-field input, .compact-number input {
    width: 100%;
  }
  .license-main, .license-controls {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}
