:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #18202a;
  --muted: #687385;
  --line: #d9dee7;
  --accent: #176b5f;
  --accent-dark: #0f4d44;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  color: #ffffff;
  background: var(--accent);
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

.portal-actions,
.form-actions,
.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.portal-actions button,
.form-actions button,
.row-actions button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
}

.portal-actions button:hover,
.form-actions button:hover,
.row-actions button:hover {
  border-color: var(--accent);
}

.row-actions .danger {
  color: #9f1d12;
}

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
}

.login-panel {
  width: min(100%, 420px);
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(24, 32, 42, 0.12);
}

.login-panel img {
  width: 92px;
  height: 92px;
  object-fit: contain;
}

.login-panel h1,
.login-panel p {
  margin: 0;
}

.login-panel h1 {
  margin-top: 16px;
  font-size: 28px;
}

.login-panel > p {
  color: var(--muted);
}

.login-panel form {
  display: grid;
  gap: 14px;
  margin-top: 26px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  color: var(--ink);
  background: #ffffff;
}

.error {
  min-height: 20px;
  color: #9f1d12;
  font-size: 14px;
}

.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

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

.portal-brand img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.portal-brand h1,
.portal-brand p {
  margin: 0;
}

.portal-brand h1 {
  font-size: 22px;
}

.portal-brand p {
  color: var(--muted);
}

.portal-main {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 32px 20px;
}

.portal-intro h2,
.portal-intro p {
  margin: 0;
}

.portal-intro h2 {
  font-size: 30px;
}

.portal-intro p {
  margin-top: 8px;
  color: var(--muted);
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.module-card {
  min-height: 170px;
  padding: 18px;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
}

.module-card.active:hover {
  border-color: var(--accent);
}

.module-card.disabled {
  opacity: 0.62;
}

.module-card span,
.module-card strong,
.module-card p {
  display: block;
}

.module-card span {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.module-card strong {
  margin-top: 14px;
  font-size: 22px;
}

.module-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.data-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(420px, 1fr);
  gap: 18px;
}

.data-form,
.data-list {
  align-self: start;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.data-form h2,
.data-list h2 {
  margin: 0 0 16px;
  font-size: 22px;
}

.data-form form {
  display: grid;
  gap: 14px;
}

.status-text,
.empty-state {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
}

#masterList {
  display: grid;
  gap: 10px;
}

.master-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.master-row strong,
.master-row span {
  display: block;
}

.master-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 820px) {
  .portal-header {
    align-items: stretch;
    flex-direction: column;
  }

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

  .data-layout,
  .master-row {
    grid-template-columns: 1fr;
  }
}
