:root {
  --navy: #0a3c77;
  --navy2: #04214a;
  --navy3: #0c549f;
  --accent: #107bdb;
  --surface: #f4f6fb;
  --surface2: #eef0f8;
  --card-bg: #ffffff;
  --text: #1a1a2e;
  --muted: #6c757d;
  --border: #e0e4f0;
  --green: #0f9b58;
  --amber: #f5a623;
  --red: #e94560;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--surface);
  color: var(--text);
  min-height: 100vh;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: white; color: var(--text); width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy3); box-shadow: 0 0 0 3px rgba(12,84,159,.15); }
label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }

.btn { border: none; border-radius: 8px; padding: 10px 18px; font-size: 13px; font-weight: 600; cursor: pointer; transition: filter .15s; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: white; }
.btn-outline { background: white; border: 1px solid var(--border); color: var(--text); }
.btn-danger { background: white; border: 1px solid var(--red); color: var(--red); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.badge-active { background: #e8f8f0; color: var(--green); }
.badge-suspended { background: #fff3d9; color: #b8860b; }
.badge-revoked { background: #fde8ec; color: var(--red); }
.badge-converted { background: #e6f0fb; color: var(--navy); }
.badge-trial { background: #f3e8fd; color: #7b2ff7; }
.badge-tier { background: var(--surface2); color: var(--navy); }

/* ----- Login screen ----- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--navy2) 0%, #0c1f3d 100%); }
.login-card { background: white; border-radius: 16px; padding: 40px; width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-card img { width: 64px; display: block; margin: 0 auto 16px; }
.login-card h1 { text-align: center; font-size: 20px; color: var(--navy2); margin-bottom: 4px; }
.login-card .sub { text-align: center; font-size: 13px; color: var(--muted); margin-bottom: 26px; }
.login-card .field { margin-bottom: 14px; }
.login-error { background: #fde8ec; color: var(--red); padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; display: none; }
.login-error.show { display: block; }

/* ----- App shell ----- */
.app-header { background: linear-gradient(135deg, var(--navy) 0%, var(--navy3) 60%, var(--navy2) 100%); color: white; height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; box-shadow: 0 3px 10px rgba(0,0,0,.25); }
.app-header .brand { display: flex; align-items: center; gap: 12px; }
.app-header .brand img { height: 32px; }
.app-header .brand-text { font-weight: 700; font-size: 16px; letter-spacing: .3px; }
.app-header .brand-text small { display: block; font-weight: 400; font-size: 11px; opacity: .7; }
.app-header .who { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.app-header .who .pill { background: rgba(255,255,255,.12); padding: 6px 14px; border-radius: 20px; }

.tabs { display: flex; gap: 8px; padding: 16px 24px 0; }
.tab-btn { background: var(--surface2); color: var(--muted); border: none; border-radius: 8px 8px 0 0; padding: 10px 20px; font-size: 13px; font-weight: 600; }
.tab-btn.active { background: var(--card-bg); color: var(--navy); }

.content { padding: 24px; max-width: 1280px; margin: 0 auto; }
.toolbar { display: flex; gap: 10px; margin-bottom: 18px; align-items: center; flex-wrap: wrap; }
.toolbar input[type=text] { max-width: 280px; }
.toolbar select { max-width: 160px; }
.toolbar .spacer { flex: 1; }

.card { background: var(--card-bg); border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.07); overflow: hidden; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { background: var(--navy); color: white; }
th { padding: 11px 14px; text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; }
td { padding: 12px 14px; border-bottom: 1px solid var(--surface2); }
tbody tr:hover { background: var(--surface); }
.mono { font-family: "Cascadia Code", "Consolas", monospace; font-size: 12.5px; letter-spacing: .3px; }
.row-actions { display: flex; gap: 6px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .icon { font-size: 40px; margin-bottom: 10px; }

/* ----- Modal ----- */
.modal-overlay { position: fixed; inset: 0; background: rgba(4,33,74,.55); display: flex; align-items: center; justify-content: center; z-index: 500; padding: 20px; }
.modal { background: white; border-radius: 14px; width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-header { background: var(--navy); color: white; padding: 16px 22px; display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16px; }
.modal-close { background: none; border: none; color: rgba(255,255,255,.7); font-size: 20px; }
.modal-body { padding: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-body .span { grid-column: 1 / -1; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--surface2); display: flex; justify-content: flex-end; gap: 10px; }

.entitlement-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 18px 22px; }
.entitlement-grid .item { background: var(--surface); border-radius: 8px; padding: 10px 12px; }
.entitlement-grid .item .num { font-size: 20px; font-weight: 800; color: var(--navy); }
.entitlement-grid .item .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.feature-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 22px 18px; }
.chip { font-size: 11px; padding: 4px 10px; border-radius: 12px; background: var(--surface2); color: var(--muted); font-weight: 600; }
.chip.on { background: #e8f8f0; color: var(--green); }

.toast { position: fixed; bottom: 24px; right: 24px; background: var(--navy); color: white; padding: 12px 20px; border-radius: 10px; font-size: 13px; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.25); z-index: 1000; }
.toast.error { background: var(--red); }

.helptext { font-size: 11px; color: var(--muted); margin-top: 4px; }
