:root {
  --bg: #ffffff;
  --card: #ffffff;
  --text: #172033;
  --muted: #6d6074;
  --line: #e7ddef;
  --glicine: #c9a0dc;
  --glicine-soft: #f7f0fa;
  --primary: #7b3f98;
  --primary-dark: #63307d;
  --danger: #c62828;
  --danger-dark: #9f1f1f;
  --soft: #fbf8fc;
  --success-bg: #e8f6ee;
  --success-text: #17643a;
  --error-bg: #fdecec;
  --error-text: #9f1f1f;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.dashboard-body {
  min-height: 100vh;
  background: var(--soft);
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 48px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 18px;
  background: #ffffff;
  border-right: 1px solid var(--line);
  box-shadow: 8px 0 24px rgba(123, 63, 152, 0.08);
}

.sidebar-brand {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.sidebar-image {
  display: block;
  width: min(190px, 100%);
  height: auto;
  margin-left: auto;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 6px;
  color: #4f4458;
  font-weight: 700;
  text-decoration: none;
}

.sidebar-link:hover,
.sidebar-link.active {
  background: var(--glicine-soft);
  color: var(--primary-dark);
}

.sidebar-link.active {
  box-shadow: inset 4px 0 0 var(--glicine);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.sidebar-version {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 28px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}

.sidebar-version strong {
  color: var(--muted);
  font-size: 10px;
}

.sidebar-email {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.sidebar-logout {
  width: 100%;
}

.sidebar-logout-form {
  margin-bottom: 0;
}

.dashboard-main {
  min-width: 0;
  padding: 24px;
}

.version-badge {
  position: fixed;
  left: 12px;
  bottom: 10px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  box-shadow: 0 6px 18px rgba(123, 63, 152, 0.08);
}

.version-badge strong {
  color: var(--text);
  font-size: 11px;
}

.header-card,
.card,
.recap-card,
.notice {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(123, 63, 152, 0.11);
}

.header-card {
  padding: 22px;
  border-top: 6px solid var(--glicine);
}

.header-card.compact {
  max-width: 620px;
  margin: 80px auto;
}

.header-image {
  display: block;
  width: min(384px, 100%);
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  margin: 0 0 20px auto;
  border: 0;
}

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

.landing-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 8px;
  font-size: 30px;
  color: var(--primary-dark);
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.muted {
  color: var(--muted);
  margin-bottom: 0;
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.button.primary {
  background: var(--primary);
}

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

.button.secondary {
  background: #4f4458;
}

.button.danger {
  background: var(--danger);
}

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

.button.small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
}

.login-button {
  margin-top: 18px;
}

.login-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.notice {
  margin: 18px 0;
  padding: 14px 16px;
}

.notice.success {
  background: var(--success-bg);
  color: var(--success-text);
}

.notice.error {
  background: var(--error-bg);
  color: var(--error-text);
}

.recap-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.recap-section {
  margin-top: 20px;
}

.landing-recap-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.recap-card {
  padding: 18px;
  border-top: 4px solid var(--glicine);
}

.recap-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.recap-card strong {
  font-size: 22px;
}

.card {
  margin-top: 20px;
  padding: 20px;
}

.section-heading {
  margin-bottom: 16px;
}

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

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--glicine-soft);
  color: var(--primary-dark);
  font-size: 13px;
}

input {
  width: 100%;
  min-height: 38px;
  border: 1px solid #d9c8e4;
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
}

input:focus {
  outline: 3px solid rgba(201, 160, 220, 0.35);
  border-color: var(--primary);
}

input[readonly] {
  background: var(--glicine-soft);
  color: var(--muted);
}

.readonly-value {
  display: block;
  min-width: 120px;
  color: var(--text);
  font-weight: 700;
}

.record-form,
.settings-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.settings-card {
  max-width: 820px;
}

label {
  display: grid;
  gap: 7px;
  color: #4f4458;
  font-weight: 700;
  font-size: 14px;
}

.form-actions {
  align-self: end;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 24px rgba(123, 63, 152, 0.08);
  }

  .sidebar-brand {
    padding-bottom: 12px;
  }

  .sidebar-image {
    width: min(190px, 100%);
    margin-left: 0;
  }

  .sidebar-footer {
    margin-top: 0;
  }

  .dashboard-main {
    padding: 16px;
  }

  .header-row,
  .landing-hero,
  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .recap-grid,
  .record-form,
  .settings-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .button {
    width: 100%;
  }
}

@media (max-width: 620px) {
  .page {
    width: min(100% - 20px, 1180px);
    margin-top: 10px;
  }

  .header-card,
  .card {
    padding: 14px;
  }

  .recap-grid,
  .landing-recap-grid,
  .record-form,
  .settings-form {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 24px;
  }
}
