* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background: #f5f7f8;
  color: #1c2930;
}

button,
input,
select {
  font: inherit;
}


/* ============================================================
   Sidebar
   ============================================================ */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  padding: 28px 20px;
  background: #123b42;
  color: #ffffff;
  display: flex;
  flex-direction: column;
}

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

.brand-logo {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 10px;
  background: #f28a2e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-name {
  font-size: 19px;
  font-weight: 700;
}

.brand-subtitle {
  margin-top: 3px;
  font-size: 12px;
  opacity: 0.70;
}

.nav-item {
  display: block;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.10);
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.16);
}

.sidebar-footer {
  margin-top: auto;
  font-size: 12px;
  line-height: 1.6;
  opacity: 0.55;
}


/* ============================================================
   Main layout
   ============================================================ */

.main {
  min-height: 100vh;
  margin-left: 250px;
}

.topbar {
  min-height: 95px;
  padding: 22px 38px;
  background: #ffffff;
  border-bottom: 1px solid #e3e8ea;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.topbar-heading {
  min-width: 0;
}

.eyebrow {
  color: #708287;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

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

.content {
  padding: 34px 38px;
}


/* ============================================================
   Admin identity / Logout
   ============================================================ */

.admin-account {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-identity {
  text-align: right;
}

.admin-name {
  color: #26383e;
  font-size: 14px;
  font-weight: 700;
}

.admin-role {
  margin-top: 4px;
  color: #78878c;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.logout-form {
  margin: 0;
}


/* ============================================================
   Page content
   ============================================================ */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 24px;
}

.page-header h2 {
  margin: 0 0 7px;
}

.page-header p {
  margin: 0;
  color: #6d7c82;
}

.card {
  margin-bottom: 22px;
  padding: 24px;
  background: #ffffff;
  border: 1px solid #e1e7e9;
  border-radius: 12px;
}

.card h3 {
  margin-top: 0;
}


/* ============================================================
   Tables
   ============================================================ */

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

th {
  padding: 13px 14px;
  text-align: left;
  color: #6e7d82;
  font-size: 12px;
  text-transform: uppercase;
  border-bottom: 1px solid #e5eaec;
}

td {
  padding: 16px 14px;
  border-bottom: 1px solid #eef1f2;
}

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

.company-name {
  color: #123b42;
  font-weight: 700;
  text-decoration: none;
}

.company-name:hover {
  text-decoration: underline;
}

.company-code {
  margin-top: 4px;
  color: #89969b;
  font-size: 12px;
}


/* ============================================================
   Status
   ============================================================ */

.status {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.status.active {
  background: #e7f5ed;
  color: #227047;
}

.status.uat,
.uat-banner {
  background: #fff0d6;
  color: #87520a;
  font-weight: 800;
}

.uat-banner {
  margin: 18px 0;
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 11px;
  letter-spacing: .05em;
}

.side-banner { margin: 0 0 18px; }
.company-sidebar .nav-item { margin-bottom: 4px; background: transparent; font-size: 13px; }
.company-sidebar .nav-item.selected { background: rgba(255,255,255,.16); }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.metric { padding: 20px; background: #fff; border: 1px solid #e1e7e9; border-radius: 12px; }
.metric span { display: block; color: #718086; font-size: 12px; }
.metric strong { display: block; margin-top: 8px; font-size: 28px; }
.row-line { display: flex; justify-content: space-between; gap: 20px; padding: 13px 0; border-bottom: 1px solid #eef1f2; }
.row-line:last-child { border-bottom: 0; }
.muted { color: #718086; }
.json-block { overflow: auto; padding: 16px; background: #f4f7f8; border-radius: 8px; }
@media (max-width: 850px) { .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }


/* ============================================================
   Buttons
   ============================================================ */

.button {
  display: inline-block;
  border: 0;
  border-radius: 8px;
  padding: 11px 17px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  background: #123b42;
  color: #ffffff;
}

.button.primary:hover {
  background: #0e3238;
}

.button.secondary {
  background: #edf1f2;
  color: #24373c;
}

.button.secondary:hover {
  background: #e2e8ea;
}

.button.compact {
  padding: 9px 13px;
  font-size: 12px;
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}


/* ============================================================
   Alerts
   ============================================================ */

.alert {
  padding: 14px 16px;
  margin-bottom: 20px;
  border-radius: 8px;
}

.alert.error {
  background: #fde8e8;
  color: #8f2f2f;
}

.alert.success {
  background: #e7f5ed;
  color: #226342;
}

.empty {
  padding: 35px;
  text-align: center;
  color: #88969a;
}


/* ============================================================
   Forms
   ============================================================ */

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

.form-grid label,
.login-form label {
  display: block;
  color: #314349;
  font-size: 13px;
  font-weight: 700;
}

.form-grid input,
.form-grid select,
.login-form input {
  width: 100%;
  margin-top: 7px;
  padding: 11px 12px;
  border: 1px solid #ccd5d8;
  border-radius: 7px;
  outline: none;
  background: #ffffff;
  color: #1c2930;
  font-size: 14px;
}

.form-grid input:focus,
.form-grid select:focus,
.login-form input:focus {
  border-color: #6e9299;
  box-shadow: 0 0 0 3px rgba(18, 59, 66, 0.08);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}


/* ============================================================
   Detail pages
   ============================================================ */

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

.detail-grid div {
  font-weight: 700;
}

.detail-grid span {
  display: block;
  margin-bottom: 5px;
  color: #718086;
  font-size: 12px;
  font-weight: 400;
}


/* ============================================================
   Login
   ============================================================ */

.login-page {
  background: #f2f5f6;
}

.login-shell {
  min-height: 100vh;
  padding: 40px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 430px;
  padding: 38px;
  background: #ffffff;
  border: 1px solid #e0e7e9;
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(25, 47, 54, 0.08);
}

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

.login-brand-name {
  color: #123b42;
}

.login-subtitle {
  margin-top: 3px;
  color: #7a898e;
  font-size: 12px;
}

.login-heading {
  margin: 34px 0 26px;
}

.login-heading h1 {
  margin: 0;
  color: #172a30;
  font-size: 30px;
}

.login-heading p {
  margin: 8px 0 0;
  color: #738287;
  font-size: 14px;
}

.login-form {
  display: grid;
  gap: 19px;
}

.login-form input {
  padding: 13px 14px;
}

.login-button {
  width: 100%;
  margin-top: 5px;
  padding: 13px 18px;
}

.login-footer {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #edf0f1;
  color: #8a979b;
  font-size: 11px;
  text-align: center;
}


/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 850px) {
  .sidebar {
    position: static;
    width: 100%;
    min-height: auto;
  }

  .sidebar-footer {
    margin-top: 30px;
  }

  .main {
    margin-left: 0;
  }

  .topbar {
    align-items: flex-start;
    padding: 20px 22px;
  }

  .content {
    padding: 24px 22px;
  }

  .page-header {
    flex-direction: column;
  }

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

@media (max-width: 560px) {
  .topbar {
    flex-direction: column;
  }

  .admin-account {
    width: 100%;
    justify-content: space-between;
  }

  .admin-identity {
    text-align: left;
  }

  .login-shell {
    padding: 20px 14px;
  }

  .login-card {
    padding: 28px 22px;
  }

  .card {
    overflow-x: auto;
  }
}
