:root {
  --bg: #f4f7f6;
  --panel: #ffffff;
  --panel-2: #eef4f1;
  --ink: #14231f;
  --muted: #66736f;
  --line: #d8e2de;
  --brand: #176b5b;
  --brand-dark: #0d453b;
  --accent: #b8872f;
  --danger: #b42318;
  --warning: #a05a00;
  --success: #137333;
  --info: #1a5fb4;
  --shadow: 0 16px 45px rgba(22, 39, 34, .08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 520px) 1fr;
  background: #f7faf8;
}

.login-panel {
  padding: 42px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--line);
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 42px;
}

.logo {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.brand-title {
  font-size: 18px;
  font-weight: 750;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 13px;
}

.login-panel h1 {
  margin: 0 0 10px;
  font-size: 32px;
  line-height: 1.08;
}

.login-panel p {
  margin: 0 0 28px;
  color: var(--muted);
  line-height: 1.55;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 15px;
}

.field label {
  font-size: 13px;
  color: #32433e;
  font-weight: 650;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(23, 107, 91, .14);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.btn.secondary {
  background: #e9f1ee;
  color: var(--brand-dark);
}

.btn.ghost {
  background: transparent;
  color: var(--brand-dark);
}

.btn.danger {
  background: #fee4e2;
  color: var(--danger);
}

.btn.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.login-as {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}

.role-chip {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 11px 12px;
  text-align: left;
  color: var(--ink);
}

.role-chip strong {
  display: block;
}

.role-chip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.login-visual {
  padding: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.security-board {
  width: min(760px, 100%);
  display: grid;
  gap: 18px;
}

.security-topline {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 18px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  background: #10241f;
  color: #d8ede6;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sidebar .logo {
  background: #e4b860;
  color: #15201d;
}

.tenant-context {
  padding: 12px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
}

.tenant-context strong {
  display: block;
  font-size: 13px;
}

.tenant-context span {
  color: #aac6bd;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav button {
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #d8ede6;
  background: transparent;
  border-radius: 8px;
  text-align: left;
}

.nav button.active,
.nav button:hover {
  background: rgba(255,255,255,.1);
}

.nav-icon {
  width: 24px;
  text-align: center;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 74px;
  padding: 0 26px;
  background: rgba(255,255,255,.86);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(14px);
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.content {
  padding: 24px 26px 42px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.card.compact {
  padding: 14px;
}

.card h2,
.card h3 {
  margin: 0 0 12px;
}

.card h2 {
  font-size: 18px;
}

.card h3 {
  font-size: 15px;
}

.metric {
  display: grid;
  gap: 5px;
}

.metric .value {
  font-size: 30px;
  font-weight: 800;
}

.metric .label {
  color: var(--muted);
  font-size: 13px;
}

.metric.good .value {
  color: var(--success);
}

.metric.warn .value {
  color: var(--warning);
}

.metric.bad .value {
  color: var(--danger);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  background: #fff;
}

th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

th {
  background: #f2f7f5;
  color: #34443f;
  font-weight: 750;
}

tr:last-child td {
  border-bottom: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  background: #eef2f1;
  color: #33423e;
  white-space: nowrap;
}

.pill.good {
  background: #dcfce7;
  color: #166534;
}

.pill.warn {
  background: #fef3c7;
  color: #92400e;
}

.pill.bad {
  background: #fee2e2;
  color: #991b1b;
}

.pill.info {
  background: #dbeafe;
  color: #1e40af;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.toolbar .field {
  margin: 0;
  min-width: 210px;
}

.split {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 16px;
}

.notice {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: #41514c;
  line-height: 1.45;
}

.notice.critical {
  border-color: #fecaca;
  background: #fff1f2;
  color: #7f1d1d;
}

.notice.safe {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #14532d;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(7, 18, 15, .42);
  z-index: 20;
}

.modal {
  width: min(760px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 30px 90px rgba(0,0,0,.24);
  padding: 20px;
}

.modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.modal-head h2 {
  margin: 0 0 4px;
}

.modal-head p {
  margin: 0;
  color: var(--muted);
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
}

.footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.mini-list {
  display: grid;
  gap: 10px;
}

.mini-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.mini-item strong {
  display: block;
}

.mini-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.legal-bar {
  margin-top: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 980px) {
  .login-shell,
  .app-shell,
  .security-topline,
  .split,
  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4 {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .app-shell {
    display: block;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .login-panel,
  .login-visual,
  .content,
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar {
    height: auto;
    padding-top: 14px;
    padding-bottom: 14px;
    align-items: flex-start;
    gap: 12px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .nav {
    grid-template-columns: 1fr;
  }
}
