:root {
  --bg: #080c14;
  --panel: #111827;
  --panel-2: #162033;
  --soft: #0d1422;
  --border: #263247;
  --text: #eef4ff;
  --muted: #94a3b8;
  --primary: #38bdf8;
  --primary-2: #8b5cf6;
  --danger: #f87171;
  --ok: #34d399;
  --radius: 8px;
  --shadow: 0 18px 48px rgba(0,0,0,.28);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(56,189,248,.18), transparent 34%),
    radial-gradient(circle at 95% 15%, rgba(139,92,246,.16), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.license-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
}
.license-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.license-topbar h1 {
  margin: 6px 0 6px;
  font-size: clamp(30px, 4vw, 48px);
  letter-spacing: 0;
}
.license-topbar p,
.panel-head span,
.status-line {
  color: var(--muted);
}
.access-box {
  display: grid;
  gap: 5px;
  border: 1px solid rgba(148,163,184,.28);
  border-radius: var(--radius);
  background: rgba(15,23,42,.82);
  color: var(--text);
  padding: 10px;
}
.access-box b {
  color: #fde68a;
}
.access-box span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.access-box div {
  overflow-wrap: anywhere;
}
.access-box .btn {
  width: fit-content;
  margin-top: 4px;
}
.muted-line {
  color: var(--muted);
  font-size: 13px;
}
.back-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}
.panel {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(17,24,39,.94), rgba(13,20,34,.94));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.panel-head h2 {
  margin: 0;
  font-size: 18px;
}
.login-form,
.date-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 10px;
}
.date-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.stack-form {
  display: grid;
  gap: 10px;
}
.stack-form [type="hidden"] {
  display: none;
}
.form-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #090f1b;
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  outline: none;
}
textarea.input {
  resize: vertical;
  min-height: 88px;
}
.software-field {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 12px;
  background: rgba(9,15,27,.76);
}
.software-field legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.software-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}
.software-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 10px;
  background: rgba(255,255,255,.03);
  cursor: pointer;
}
.software-check:has(input:checked) {
  border-color: rgba(52,211,153,.55);
  background: rgba(52,211,153,.08);
}
.software-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--ok);
}
.software-check span {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}
.license-detail-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
  align-items: start;
}
.license-detail-card {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 14px;
  background: rgba(15,23,42,.58);
}
.license-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.license-detail-head b {
  font-size: 15px;
}
.license-detail-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.license-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.license-detail-card textarea.input {
  min-height: 64px;
}
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(56,189,248,.14);
}
.btn {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0 14px;
  color: var(--text);
  background: var(--panel-2);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.btn-primary {
  border: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}
.btn-ghost {
  background: transparent;
}
.btn-danger {
  color: #fecaca;
  border-color: rgba(248,113,113,.38);
}
.btn-sm {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}
.hidden { display: none !important; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.stat-card {
  border: 1px solid var(--border);
  background: var(--soft);
  border-radius: var(--radius);
  padding: 14px;
}
.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.stat-card b {
  display: block;
  margin-top: 6px;
  font-size: 28px;
}
.work-grid {
  display: grid;
  grid-template-columns: minmax(360px, .9fr) minmax(420px, 1.1fr);
  gap: 14px;
  margin-bottom: 14px;
}
.item-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.company-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 8px;
  margin-bottom: 10px;
}
.company-tools .input {
  min-height: 40px;
}
.company-list {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}
.company-list-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 2px 2px 4px;
}
.company-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(8,12,20,.62);
  padding: 10px;
}
.company-card.selected {
  border-color: rgba(56,189,248,.42);
  background: rgba(56,189,248,.08);
}
.company-card-main {
  display: grid;
  gap: 3px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.company-card-main b {
  overflow-wrap: anywhere;
}
.company-card-main span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.company-card-meta {
  display: grid;
  justify-items: end;
  gap: 4px;
}
.company-card-meta strong {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.company-card-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.company-card-actions .btn {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}
.company-table-wrap {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(8,12,20,.62);
}
.company-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.company-table th,
.company-table td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(38,50,71,.72);
  text-align: left;
  vertical-align: middle;
}
.company-table th:nth-child(1),
.company-table td:nth-child(1) {
  width: 42%;
}
.company-table th:nth-child(2),
.company-table td:nth-child(2) {
  width: 20%;
}
.company-table th:nth-child(3),
.company-table td:nth-child(3) {
  width: 38%;
}
.company-table th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.company-table tr:last-child td {
  border-bottom: 0;
}
.company-table tr.selected td {
  background: rgba(56,189,248,.09);
}
.company-table .item-actions {
  justify-content: flex-start;
}
.company-table .btn-sm {
  min-height: 30px;
  padding: 0 8px;
  font-size: 11px;
}
.company-table .badge {
  font-size: 11px;
  padding: 3px 7px;
}
.company-main {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.company-main b {
  overflow-wrap: anywhere;
}
.company-main span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.list-divider {
  background: rgba(255,255,255,.03);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.table-empty {
  color: var(--muted);
  text-align: center;
}
.company-detail {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  border: 1px solid rgba(38,50,71,.74);
  border-radius: var(--radius);
  background: rgba(8,12,20,.42);
  padding: 12px;
}
.company-detail .stack-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.company-detail .stack-form label:nth-of-type(3),
.company-detail .form-actions,
.company-detail .access-box {
  grid-column: 1 / -1;
}
.compact-head {
  margin-bottom: 0;
}
.company-access {
  margin-top: 12px;
}
.company-edit-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.company-edit-form label:nth-of-type(4),
.company-edit-form .form-actions,
.company-edit-form .status-line {
  grid-column: 1 / -1;
}
.company-license-box {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  border: 1px solid rgba(38,50,71,.74);
  border-radius: var(--radius);
  background: rgba(8,12,20,.42);
  padding: 12px;
}
.company-license-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.company-license-head div {
  display: grid;
  gap: 2px;
}
.company-license-head span,
.company-license-row span,
.company-license-row p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.company-license-list {
  display: grid;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.company-license-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: rgba(8,12,20,.56);
}
.company-license-row + .company-license-row {
  border-top: 1px solid rgba(38,50,71,.72);
}
.company-license-row > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.company-license-row b,
.company-license-row p {
  overflow-wrap: anywhere;
}
.license-editor .stack-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.license-editor .stack-form > label:first-of-type,
.license-editor .selected-company-summary,
.license-editor .software-field,
.license-editor .license-detail-list,
.license-editor .date-row,
.license-editor .stack-form > label:has(textarea),
.license-editor .btn-primary,
.license-editor .status-line,
.license-editor .access-box {
  grid-column: 1 / -1;
}
.license-editor .btn-primary {
  justify-self: stretch;
  margin-top: 2px;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3,7,18,.72);
}
.modal-card {
  width: min(560px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(17,24,39,.98), rgba(13,20,34,.98));
  box-shadow: var(--shadow);
  padding: 18px;
}
.selected-company-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(56,189,248,.25);
  border-radius: var(--radius);
  background: rgba(56,189,248,.07);
  padding: 10px 12px;
}
.selected-company-summary div {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.selected-company-summary b {
  overflow-wrap: anywhere;
}
.selected-company-summary span,
.selected-company-summary > span {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.summary-meta {
  justify-items: end;
}
.summary-meta strong {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}
.license-list {
  margin-top: 0;
}
.license-company {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(8,12,20,.62);
  overflow: hidden;
}
.license-company-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.03);
}
.license-company-head h3 {
  margin: 0 0 2px;
  font-size: 16px;
}
.license-company-head span,
.license-main span,
.license-main p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.license-company-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.license-company-meta b {
  color: var(--muted);
  font-size: 13px;
}
.license-table {
  display: grid;
}
.license-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 9px 12px;
}
.license-row + .license-row {
  border-top: 1px solid rgba(38,50,71,.72);
}
.license-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.license-main b {
  font-size: 15px;
  overflow-wrap: anywhere;
}
.license-main p {
  overflow-wrap: anywhere;
}
.item {
  width: 100%;
  display: grid;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(8,12,20,.62);
  color: var(--text);
  padding: 12px;
  text-align: left;
  font: inherit;
}
button.item {
  cursor: pointer;
}
button.item:hover {
  border-color: var(--primary);
}
button.item.selected {
  border-color: var(--primary);
  background: rgba(56,189,248,.09);
}
.item b {
  overflow-wrap: anywhere;
}
.item span,
.item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.item-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.license-row .item-actions {
  flex-wrap: wrap;
}
.license-row .btn {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}
.badge {
  justify-self: start;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.badge.aktiv { color: var(--ok); border-color: rgba(52,211,153,.32); }
.badge.gesperrt,
.badge.abgelaufen { color: #fca5a5; border-color: rgba(248,113,113,.35); }
.badge.pausiert { color: #fde68a; border-color: rgba(253,230,138,.35); }
.badge.archiviert { color: #cbd5e1; border-color: rgba(148,163,184,.4); }
.empty {
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

@media (max-width: 820px) {
  .license-topbar,
  .panel-head {
    display: grid;
  }
  .login-form,
  .date-row,
  .stats-grid,
  .work-grid,
  .form-actions,
  .company-tools {
    grid-template-columns: 1fr;
  }
  .license-row {
    grid-template-columns: 1fr;
  }
  .license-row .item-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .license-company-head {
    align-items: flex-start;
  }
  .license-company-meta,
  .license-row .item-actions {
    justify-content: flex-start;
  }
  .company-detail .stack-form,
  .company-edit-form,
  .license-editor .stack-form,
  .license-detail-grid,
  .selected-company-summary,
  .company-license-row {
    grid-template-columns: 1fr;
    display: grid;
  }
  .company-license-head {
    display: grid;
  }
  .summary-meta {
    justify-items: start;
  }
}
