:root {
  --ink: #13213c;
  --muted: #61708a;
  --line: #d7dfeb;
  --page: #eef3f8;
  --panel: #ffffff;
  --blue: #1557d6;
  --blue-soft: #e2ebff;
  --green: #0d9b6c;
  --green-soft: #d8f5e9;
  --yellow: #e7ae16;
  --yellow-soft: #fff0b8;
  --coral: #dc5250;
  --coral-soft: #ffe0df;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 1180px;
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--page);
  color: var(--ink);
  font-family: Roboto, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.55;
}

button,
input,
select {
  outline: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  box-shadow: 0 0 0 4px rgba(21, 87, 214, 0.18);
}

svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.hidden {
  display: none !important;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background: #eaf0f7;
}

.login-panel {
  width: 430px;
  border: 1px solid #ced9e8;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 55px rgba(27, 50, 86, 0.13);
}

.login-brand,
.portal-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-brand {
  padding: 22px 26px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 2px solid #15315f;
  border-radius: 7px;
  background: var(--blue);
  box-shadow: 5px 5px 0 #31b98a;
  color: #fff;
  font-size: 17px;
  font-weight: 900;
}

.login-brand strong,
.portal-brand strong {
  display: block;
  font-size: 17px;
}

.login-brand small,
.portal-brand small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.login-copy {
  padding: 30px 32px 12px;
}

.login-copy p,
.workspace-header p,
.modal header p {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.login-copy h1 {
  margin: 0 0 8px;
  font-size: 30px;
}

.login-copy span {
  color: var(--muted);
  font-size: 14px;
}

.login-form {
  display: grid;
  gap: 17px;
  padding: 20px 32px 28px;
}

.login-form label,
.modal-form label {
  display: grid;
  gap: 7px;
  color: #3c4c67;
  font-size: 12px;
  font-weight: 800;
}

.field-control {
  position: relative;
  display: block;
}

.field-control svg {
  position: absolute;
  top: 13px;
  left: 13px;
  width: 18px;
  color: #65758e;
}

.field-control input,
.modal-form input,
.modal-form select {
  width: 100%;
  height: 46px;
  border: 1px solid #cbd6e5;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

.field-control input {
  padding: 0 13px 0 43px;
}

.modal-form input,
.modal-form select {
  padding: 0 12px;
}

.form-error {
  min-height: 18px;
  margin: -4px 0;
  color: #b62c2c;
  font-size: 12px;
}

.primary-command,
.secondary-command {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 6px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 800;
}

.primary-command {
  border: 1px solid #0d3e9a;
  background: var(--blue);
  color: #fff;
}

.secondary-command {
  border: 1px solid #cbd6e5;
  background: #fff;
  color: #3d4d68;
}

.login-panel > footer {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 15px 32px;
  color: var(--muted);
  font-size: 11px;
}

.login-panel > footer svg {
  width: 17px;
  color: var(--green);
}

.admin-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #fff;
}

.portal-brand {
  min-height: 74px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}

.portal-brand .brand-mark {
  width: 43px;
  height: 43px;
  box-shadow: 4px 4px 0 #31b98a;
  font-size: 15px;
}

.sidebar nav {
  display: grid;
  gap: 7px;
  padding: 22px 14px;
}

.nav-button {
  display: grid;
  min-height: 48px;
  grid-template-columns: 25px 1fr auto;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #52617a;
  padding: 0 13px;
  text-align: left;
  font-size: 14px;
  font-weight: 750;
}

.nav-button.active {
  border-color: #bbcdf1;
  background: var(--blue-soft);
  color: #174da9;
}

.nav-button b {
  min-width: 24px;
  border-radius: 10px;
  background: var(--coral);
  color: #fff;
  padding: 3px 7px;
  text-align: center;
  font-size: 10px;
}

.account-panel {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 17px 14px;
}

.account-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 6px;
  background: var(--green-soft);
  color: #087454;
}

.account-panel strong,
.account-panel small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-panel strong {
  font-size: 12px;
}

.account-panel small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid #cbd6e5;
  border-radius: 6px;
  background: #fff;
  color: #3e4f69;
  padding: 0;
}

.icon-button.danger {
  border-color: #f0bdbb;
  color: #b53734;
}

.workspace {
  min-width: 0;
  padding: 28px 34px 50px;
}

.workspace-header {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.workspace-header h1 {
  margin: 0;
  font-size: 30px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-control {
  position: relative;
}

.search-control svg {
  position: absolute;
  top: 13px;
  left: 13px;
  width: 18px;
  color: #66758c;
}

.search-control input {
  width: 340px;
  height: 44px;
  border: 1px solid #cbd6e5;
  border-radius: 6px;
  background: #fff;
  padding: 0 13px 0 42px;
  color: var(--ink);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  margin: 22px 0 13px;
}

.metric {
  display: flex;
  min-height: 94px;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 16px;
}

.metric > span {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border: 2px solid #233554;
  border-radius: 6px;
}

.metric-yellow > span { background: var(--yellow-soft); color: #816000; }
.metric-green > span { background: var(--green-soft); color: #087454; }
.metric-blue > span { background: var(--blue-soft); color: #164da9; }
.metric-coral > span { background: var(--coral-soft); color: #a33432; }

.metric strong,
.metric small {
  display: block;
}

.metric strong {
  font-size: 25px;
}

.metric small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.notice {
  display: flex;
  min-height: 30px;
  align-items: center;
  gap: 8px;
  color: #516078;
  font-size: 12px;
}

.notice span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #30ba80;
}

.notice-error {
  color: #a23230;
}

.notice-error span {
  background: var(--coral);
}

.content-view {
  margin-top: 7px;
}

.data-section {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.section-heading {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 20px;
}

.section-heading h2,
.section-heading p {
  margin: 0;
}

.section-heading h2 {
  font-size: 17px;
}

.section-heading p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.section-heading > span,
.subsection-heading > span {
  border-radius: 5px;
  background: #f0f3f8;
  padding: 8px 10px;
  color: #53617a;
  font-size: 11px;
  font-weight: 800;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: #f5f7fa;
  color: #59677e;
  padding: 13px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 900;
}

td {
  border-top: 1px solid #e3e9f0;
  padding: 13px 14px;
  color: #43516a;
  font-size: 12px;
  vertical-align: middle;
}

tbody tr:first-child td {
  border-top: 0;
}

td strong,
td small {
  display: block;
}

td strong {
  color: var(--ink);
  font-size: 12px;
}

td small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

code {
  font-family: "Roboto Mono", Consolas, monospace;
  font-size: 10px;
}

.status {
  display: inline-block;
  border: 1px solid;
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 10px;
  font-weight: 850;
}

.status-active,
.status-approved {
  border-color: #9bd8c0;
  background: var(--green-soft);
  color: #087454;
}

.status-pending {
  border-color: #e5ca6d;
  background: var(--yellow-soft);
  color: #715200;
}

.status-rejected,
.status-revoked {
  border-color: #efb2b0;
  background: var(--coral-soft);
  color: #a3312f;
}

.row-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
}

.action {
  display: inline-flex;
  min-height: 31px;
  align-items: center;
  gap: 5px;
  border: 1px solid;
  border-radius: 5px;
  padding: 0 9px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.action svg {
  width: 14px;
  height: 14px;
}

.action.approve {
  border-color: #85cdb0;
  background: var(--green-soft);
  color: #087454;
}

.action.transfer {
  border-color: #a9bfe9;
  background: var(--blue-soft);
  color: #174da9;
}

.action.reject {
  border-color: #efb2b0;
  background: var(--coral-soft);
  color: #a3312f;
}

.muted,
.empty-row,
.empty-state {
  color: #8994a6;
}

.empty-row {
  padding: 40px;
  text-align: center;
}

.subsection-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding: 17px 20px;
}

.subsection-heading h3 {
  margin: 0;
  font-size: 14px;
}

.device-list {
  border-top: 1px solid var(--line);
}

.device-list article {
  display: grid;
  min-height: 68px;
  grid-template-columns: 40px minmax(180px, 1.4fr) minmax(130px, 1fr) 90px 170px 40px;
  align-items: center;
  gap: 12px;
  border-top: 1px solid #e3e9f0;
  padding: 10px 18px;
}

.device-list article:first-child {
  border-top: 0;
}

.device-icon {
  display: grid;
  width: 37px;
  height: 37px;
  place-items: center;
  border-radius: 5px;
  background: var(--blue-soft);
  color: var(--blue);
}

.device-list strong,
.device-list code {
  display: block;
}

.device-list strong {
  font-size: 12px;
}

.device-list code,
.device-list small,
.device-list > article > span {
  color: var(--muted);
  font-size: 10px;
}

.timeline article {
  display: grid;
  min-height: 64px;
  grid-template-columns: 38px minmax(180px, 1fr) minmax(180px, 1fr) 180px;
  align-items: center;
  gap: 12px;
  border-top: 1px solid #e3e9f0;
  padding: 10px 20px;
}

.timeline article > span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 5px;
  background: var(--yellow-soft);
  color: #7c5b00;
}

.timeline strong,
.timeline small {
  display: block;
}

.timeline strong {
  font-size: 12px;
}

.timeline small,
.timeline time {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

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

.system-list article {
  display: grid;
  min-height: 86px;
  grid-template-columns: 52px minmax(0, 1fr) 100px;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 14px 18px;
}

.system-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 2px solid #263957;
  border-radius: 6px;
}

.system-icon.green { background: var(--green-soft); color: #087454; }
.system-icon.blue { background: var(--blue-soft); color: #174da9; }
.system-icon.yellow { background: var(--yellow-soft); color: #715200; }
.system-icon.coral { background: var(--coral-soft); color: #a3312f; }

.system-list h2,
.system-list p {
  margin: 0;
}

.system-list h2 {
  font-size: 15px;
}

.system-list p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.system-list b {
  color: var(--green);
  font-size: 11px;
  text-align: right;
}

.modal-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(20, 34, 58, 0.56);
}

.modal {
  width: 570px;
  border: 1px solid #bdc9da;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(14, 31, 60, 0.25);
}

.modal > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 18px 20px;
}

.modal header h2 {
  margin: 0;
  font-size: 20px;
}

.modal-device {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 20px 0;
  border: 1px solid #c8d6ec;
  border-radius: 6px;
  background: #f1f5fb;
  padding: 12px;
}

.modal-device > svg {
  color: var(--blue);
}

.modal-device strong,
.modal-device code {
  display: block;
}

.modal-device strong {
  font-size: 13px;
}

.modal-device code {
  margin-top: 4px;
  color: var(--muted);
}

.modal-form {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 18px 20px;
}

.modal-form .full {
  grid-column: 1 / -1;
}

.number-control {
  position: relative;
}

.number-control input {
  padding-right: 44px;
}

.number-control i {
  position: absolute;
  top: 15px;
  right: 10px;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
}

.modal > footer {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  border-top: 1px solid var(--line);
  padding: 14px 20px;
}

.is-busy #refreshButton svg {
  animation: spin 0.8s linear infinite;
}

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