:root {
  color-scheme: light;
  --navy: #102b4e;
  --navy-strong: #071b33;
  --blue: #1769aa;
  --blue-hover: #0f568d;
  --ink: #172033;
  --muted: #647087;
  --line: #d7dde7;
  --surface: #ffffff;
  --background: #f2f5f9;
  --danger: #b42318;
  --success: #067647;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--background);
}

button, input { font: inherit; }

button, .button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 9px 16px;
  font-weight: 650;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

button:disabled { cursor: wait; opacity: .65; }

.primary { color: #fff; background: var(--blue); }
.primary:hover { background: var(--blue-hover); }
.secondary { color: var(--ink); background: #fff; border-color: var(--line); }
.secondary:hover { background: #eef2f7; }
.danger { color: var(--danger); background: #fff; border-color: #f0b9b4; }

.auth-page {
  display: grid;
  grid-template-columns: minmax(300px, 460px) minmax(0, 1fr);
  min-height: 100vh;
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 44px;
  background: var(--navy-strong);
}

.auth-brand img {
  width: min(320px, 75vw);
  height: auto;
  display: block;
}

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.auth-panel { width: min(430px, 100%); }
.auth-panel h1 { margin: 0 0 8px; font-size: 28px; line-height: 1.2; letter-spacing: 0; }
.auth-panel .intro { margin: 0 0 28px; color: var(--muted); line-height: 1.55; }

.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field label { font-size: 14px; font-weight: 650; }
.field input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #aeb8c7;
  border-radius: 6px;
  outline: none;
}
.field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23,105,170,.15); }
.hint { margin: -8px 0 18px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.form-actions .primary { flex: 1; }

.message { display: none; margin: 0 0 18px; padding: 11px 13px; border-radius: 6px; font-size: 14px; line-height: 1.45; }
.message.visible { display: block; }
.message.error { color: #7a271a; background: #fef3f2; border: 1px solid #fecdca; }
.message.success { color: #05603a; background: #ecfdf3; border: 1px solid #abefc6; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
  padding: 12px 28px;
  color: #fff;
  background: var(--navy-strong);
}
.app-header img { display: block; width: 144px; height: auto; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.header-actions button, .header-actions a { color: #fff; background: transparent; border: 1px solid rgba(255,255,255,.35); text-decoration: none; }
.user-name { color: #d9e4f2; font-size: 14px; }

.page { width: min(1120px, calc(100% - 32px)); margin: 30px auto 56px; }
.page-title { margin-bottom: 24px; }
.page-title h1 { margin: 0 0 7px; font-size: 26px; letter-spacing: 0; }
.page-title p { margin: 0; color: var(--muted); }
.section { padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.section + .section { margin-top: 22px; }
.section h2 { margin: 0 0 18px; font-size: 18px; letter-spacing: 0; }
.user-form { display: grid; grid-template-columns: 1.2fr 1.4fr 1.2fr auto auto; gap: 12px; align-items: end; }
.user-form .field { margin: 0; }
.check { display: flex; align-items: center; gap: 8px; min-height: 44px; white-space: nowrap; }
.check input { width: 18px; height: 18px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
td { font-size: 14px; }
.status { font-weight: 650; }
.status.active { color: var(--success); }
.status.inactive { color: var(--danger); }
.row-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.row-actions button { min-height: 34px; padding: 6px 10px; font-size: 13px; }

dialog { width: min(430px, calc(100% - 32px)); padding: 22px; border: 1px solid var(--line); border-radius: 8px; }
dialog::backdrop { background: rgba(3, 13, 25, .56); }
dialog h2 { margin: 0 0 8px; font-size: 20px; }
dialog p { color: var(--muted); }

@media (max-width: 820px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-brand { min-height: 190px; padding: 24px; }
  .auth-brand img { width: 210px; }
  .auth-main { padding: 28px 20px 40px; align-items: start; }
  .app-header { align-items: flex-start; padding: 14px 16px; }
  .header-actions { justify-content: flex-end; flex-wrap: wrap; }
  .user-name { width: 100%; text-align: right; }
  .user-form { grid-template-columns: 1fr; }
}
