:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f7f9;
  color: #1e293b;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  background: #f6f7f9;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(100%, 420px);
  border: 1px solid #e1e7ef;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 64px rgb(15 23 42 / 8%);
  padding: 28px;
}

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

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #0f766e;
  color: #ffffff;
  font-weight: 900;
}

.brand-lockup strong {
  display: block;
  font-size: 1rem;
}

.brand-lockup span:not(.brand-mark) {
  color: #64748b;
  font-size: 0.88rem;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

label {
  display: grid;
  gap: 7px;
  color: #475569;
  font-size: 0.82rem;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #0f172a;
  padding: 0 12px;
}

input:focus {
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgb(15 118 110 / 14%);
  outline: none;
}

select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  padding: 0 12px;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: #0f766e;
  color: #ffffff;
  cursor: pointer;
  font-weight: 850;
  padding: 0 16px;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: #b91c1c;
  font-size: 0.9rem;
}

.status.is-error {
  color: #b91c1c;
}

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

.sidebar {
  display: flex;
  position: sticky;
  top: 0;
  flex-direction: column;
  height: 100vh;
  border-right: 1px solid #e1e7ef;
  background: #ffffff;
  padding: 24px;
}

nav {
  display: grid;
  gap: 6px;
  margin-top: 34px;
}

nav a {
  border-radius: 8px;
  color: #475569;
  font-weight: 800;
  padding: 12px;
  text-decoration: none;
}

nav a:hover,
nav a.is-active {
  background: #e6f5f3;
  color: #0f766e;
}

.ghost-button {
  margin-top: auto;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
}

.secondary-button {
  min-height: 36px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
}

.workspace {
  min-width: 0;
  padding: 30px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

#eyebrow {
  margin: 0 0 8px;
  color: #0f766e;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 2rem;
}

h2 {
  margin-bottom: 5px;
  font-size: 1.05rem;
}

.topbar p,
.panel-header p {
  margin-bottom: 0;
  color: #64748b;
}

.status {
  min-height: 22px;
  margin-bottom: 14px;
  color: #64748b;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-grid article,
.panel {
  border: 1px solid #e1e7ef;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgb(15 23 42 / 5%);
}

.metric-grid article {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.metric-grid span {
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 800;
}

.metric-grid strong {
  font-size: 2rem;
}

.panel {
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #e1e7ef;
  padding: 18px;
}

.text-link {
  color: #0f766e;
  font-weight: 850;
  text-decoration: none;
}

.pill {
  border-radius: 999px;
  background: #e6f5f3;
  color: #0f766e;
  font-size: 0.8rem;
  font-weight: 850;
  padding: 7px 10px;
  white-space: nowrap;
}

.recent-list {
  display: grid;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #edf2f7;
  padding: 15px 18px;
}

.recent-item:last-child {
  border-bottom: 0;
}

.recent-item strong,
.recent-item span {
  display: block;
}

.recent-item span,
.recent-item time {
  color: #64748b;
  font-size: 0.9rem;
}

.empty-state,
.empty-table-row {
  color: #64748b;
  padding: 18px;
  text-align: left;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1060px;
}

th,
td {
  border-bottom: 1px solid #edf2f7;
  padding: 13px 14px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8fafc;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 900;
}

td {
  color: #334155;
  font-size: 0.92rem;
}

td a {
  color: #0f766e;
  font-weight: 800;
  text-decoration: none;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.admin-form .form-body {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.client-list {
  display: grid;
}

.client-card {
  border-bottom: 1px solid #edf2f7;
}

.client-card:last-child {
  border-bottom: 0;
}

.client-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
}

.client-card-header strong,
.client-card-header span {
  display: block;
}

.client-card-header span {
  color: #64748b;
  font-size: 0.88rem;
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.client-card-body {
  display: none;
  gap: 18px;
  border-top: 1px solid #edf2f7;
  background: #fbfdff;
  padding: 18px;
}

.client-card.is-expanded .client-card-body {
  display: grid;
}

.compact-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.compact-form button {
  white-space: nowrap;
}

.user-section {
  display: grid;
  gap: 12px;
}

.user-section h3 {
  margin: 0;
  color: #334155;
  font-size: 0.95rem;
}

.user-edit-row {
  border: 1px solid #e1e7ef;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    gap: 18px;
  }

  nav {
    display: flex;
    flex-wrap: wrap;
    margin-top: 0;
  }

  .ghost-button {
    margin-top: 0;
    width: fit-content;
  }

  .workspace {
    padding: 20px;
  }

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

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

@media (max-width: 560px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .panel-header,
  .recent-item {
    align-items: flex-start;
    flex-direction: column;
  }
}
