:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #15243b;
  background: #f2f5f8;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(17, 77, 120, 0.06), transparent 45%),
    #f2f5f8;
}

button,
input,
select {
  font: inherit;
}

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

.company-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
}

.company-panel {
  width: min(100%, 920px);
  padding: 40px;
  border: 1px solid #dbe3ea;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(27, 49, 75, 0.09);
  text-align: center;
}

.auth-card {
  width: min(100%, 460px);
  padding: 40px;
  border: 1px solid #dbe3ea;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(27, 49, 75, 0.09);
  text-align: center;
}

.brand-mark {
  width: 58px;
  height: 58px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #114d78;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.environment-badge {
  display: inline-block;
  margin-bottom: 18px;
  padding: 5px 10px;
  border: 1px solid #d7a94b;
  border-radius: 999px;
  background: #fff8e8;
  color: #765415;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

h1 {
  margin: 0;
  font-size: clamp(1.35rem, 4vw, 1.8rem);
  line-height: 1.3;
  letter-spacing: 0.015em;
}

h2 {
  margin: 16px 0;
  font-size: 1.3rem;
}

.selection-title {
  margin-top: 24px;
  letter-spacing: 0.08em;
}

.subtitle,
.placeholder-note {
  margin: 10px 0 28px;
  color: #607086;
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 9px;
  text-align: left;
}

.auth-form label {
  margin-top: 9px;
  color: #34455a;
  font-size: 0.9rem;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid #bfcbd6;
  border-radius: 7px;
  color: #15243b;
  background: #ffffff;
  outline: none;
}

.auth-form input:focus {
  border-color: #17699f;
  box-shadow: 0 0 0 3px rgba(23, 105, 159, 0.14);
}

button,
.link-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 7px;
  background: #114d78;
  color: #ffffff;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  text-decoration: none;
}

.auth-form button {
  width: 100%;
  margin-top: 18px;
}

button:hover,
.link-button:hover {
  background: #0d3d61;
}

button:focus-visible,
.link-button:focus-visible,
.selection-actions a:focus-visible {
  outline: 3px solid rgba(23, 105, 159, 0.35);
  outline-offset: 3px;
}

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

.fiscal-year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 20px;
  margin-top: 28px;
}

.fiscal-year-card {
  width: 100%;
  min-height: 180px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border: 1px solid #cbd8e3;
  background: #ffffff;
  color: #15243b;
  box-shadow: 0 8px 24px rgba(27, 49, 75, 0.06);
}

.fiscal-year-card:hover {
  border-color: #17699f;
  background: #f7fbfe;
  box-shadow: 0 10px 28px rgba(17, 77, 120, 0.12);
}

.fiscal-year-label {
  font-size: 1.55rem;
  font-weight: 850;
  letter-spacing: 0.04em;
}

.fiscal-year-status {
  align-self: center;
}

.fiscal-year-dates {
  color: #607086;
  font-size: 0.85rem;
  font-weight: 650;
}

.status-closing {
  background: #fff8e8;
  color: #765415;
}

.status-open {
  background: #e8f6ee;
  color: #24734a;
}

.status-closed {
  background: #eef1f4;
  color: #48576a;
}

.company-grid form {
  min-width: 0;
}

.company-card {
  width: 100%;
  min-height: 280px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid #cbd8e3;
  background: #ffffff;
  color: #15243b;
  box-shadow: 0 8px 24px rgba(27, 49, 75, 0.06);
}

.company-card:hover {
  border-color: #17699f;
  background: #f7fbfe;
  box-shadow: 0 10px 28px rgba(17, 77, 120, 0.12);
}

.company-logo-frame {
  width: 100%;
  min-height: 116px;
  display: grid;
  place-items: center;
}

.company-logo {
  width: min(100%, 310px);
  height: 112px;
  object-fit: contain;
}

.company-code-badge,
.identity-code-badge {
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #114d78;
  color: #ffffff;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.company-code-badge {
  width: 88px;
  height: 88px;
  font-size: 1.15rem;
}

.company-code {
  padding: 4px 11px;
  border-radius: 999px;
  background: #edf3f7;
  color: #34566f;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.company-name {
  color: #15243b;
  font-size: clamp(1.18rem, 2.2vw, 1.45rem);
  font-weight: 800;
  line-height: 1.35;
}

.active-company-context,
.protected-company-context {
  margin: 28px auto 0;
  border: 1px solid #d3dfe8;
  border-radius: 12px;
  background: #f8fbfd;
}

.active-company-context {
  width: min(100%, 620px);
  padding: 22px 28px 24px;
}

.company-context-eyebrow,
.working-year-card > span {
  display: block;
  color: #607086;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.14em;
}

.identity-logo-frame {
  width: 100%;
  min-height: 118px;
  display: grid;
  place-items: center;
}

.identity-logo {
  width: min(100%, 390px);
  height: 112px;
  object-fit: contain;
}

.identity-code-badge {
  width: 92px;
  height: 92px;
  font-size: 1.2rem;
}

.company-context-name {
  margin: 3px 0 4px;
  color: #15243b;
  font-size: clamp(1.35rem, 3vw, 1.7rem);
  font-weight: 850;
  line-height: 1.3;
}

.company-context-code,
.protected-company-code {
  margin: 0;
  color: #607086;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
}

.success-card {
  width: min(100%, 680px);
}

.protected-company-context {
  padding: 22px 30px 24px;
}

.protected-company-name {
  margin: 4px 0;
  font-size: clamp(1.45rem, 3vw, 1.85rem);
  line-height: 1.3;
}

.working-year-card {
  margin: 18px 0;
  padding: 18px;
  border: 1px solid #9ed0b2;
  border-radius: 10px;
  background: #edf9f2;
  color: #276443;
}

.working-year-card strong {
  display: block;
  margin-top: 5px;
  font-size: clamp(1.35rem, 3vw, 1.65rem);
  letter-spacing: 0.025em;
}

.login-status {
  margin: 18px 0 0;
  color: #24734a;
  font-size: 0.88rem;
  font-weight: 800;
}

.login-status span {
  margin-right: 4px;
}

.selection-logout,
.selection-actions {
  margin-top: 28px;
}

.selection-actions,
.admin-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.selection-actions a,
.admin-footer a,
.form-heading a,
.form-actions a,
.table-action a {
  color: #17699f;
  font-weight: 800;
  text-decoration: none;
}

.selection-actions a:hover,
.admin-footer a:hover,
.form-heading a:hover,
.form-actions a:hover,
.table-action a:hover {
  text-decoration: underline;
}

.text-button {
  min-height: 40px;
  padding: 0 16px;
  background: transparent;
  color: #34566f;
}

.text-button:hover {
  background: #edf3f7;
}

.empty-state {
  margin: 28px 0;
  padding: 18px;
  border-radius: 8px;
  background: #f6f8fa;
  color: #607086;
}

.alert {
  margin: 20px 0 8px;
  padding: 12px 14px;
  border: 1px solid #e6b2b2;
  border-radius: 7px;
  background: #fff1f1;
  color: #902b2b;
  font-size: 0.9rem;
  text-align: left;
}

.identity-list {
  margin: 20px 0;
  padding: 18px;
  border-radius: 8px;
  background: #f6f8fa;
  text-align: left;
}

.identity-list div {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 8px;
  padding: 5px 0;
}

.identity-list dt {
  color: #607086;
}

.identity-list dd {
  margin: 0;
}

.secondary-button {
  min-width: 150px;
}

.placeholder-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.error-id {
  display: block;
  margin: 20px 0;
  padding: 12px;
  border-radius: 7px;
  background: #f2f5f8;
  color: #902b2b;
  font-size: 1rem;
  font-weight: 800;
}

.link-button {
  min-width: 130px;
  padding: 0 18px;
}

.admin-shell {
  min-height: 100vh;
  padding: 32px 20px;
}

.admin-panel {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 34px;
  border: 1px solid #dbe3ea;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(27, 49, 75, 0.09);
}

.admin-header,
.admin-header > div,
.form-actions,
.admin-footer {
  display: flex;
  align-items: center;
}

.admin-header {
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.admin-header > div {
  gap: 18px;
}

.admin-brand {
  flex: 0 0 auto;
  margin: 0;
}

.admin-header .environment-badge {
  margin-bottom: 8px;
}

.admin-subtitle {
  margin: 5px 0 0;
  color: #607086;
}

.notice {
  margin: 18px 0;
  padding: 12px 14px;
  border: 1px solid #9ed0b2;
  border-radius: 7px;
  background: #edf9f2;
  color: #276443;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid #dbe3ea;
  border-radius: 8px;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.user-table th,
.user-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #e5ebf0;
  vertical-align: top;
}

.user-table th {
  background: #f6f8fa;
  color: #42556c;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

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

.cell-detail,
.field-help,
.choice-card small {
  display: block;
  color: #607086;
  font-size: 0.84rem;
}

.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.status-active {
  background: #e8f6ee;
  color: #24734a;
}

.status-inactive {
  background: #f1f3f5;
  color: #687481;
}

.muted {
  color: #788694;
}

.table-action {
  text-align: right;
  white-space: nowrap;
}

.admin-footer {
  justify-content: flex-end;
  margin-top: 24px;
}

.form-panel {
  width: min(100%, 820px);
}

.form-heading {
  margin-bottom: 26px;
}

.form-heading .environment-badge {
  margin: 18px 0 10px;
}

.admin-form {
  display: grid;
  gap: 20px;
}

.admin-form fieldset,
.password-reset {
  margin: 0;
  padding: 20px;
  border: 1px solid #dbe3ea;
  border-radius: 8px;
}

.admin-form legend {
  padding: 0 8px;
  font-weight: 800;
}

.admin-form label,
.field-label {
  display: block;
  margin: 12px 0 6px;
  color: #34455a;
  font-size: 0.9rem;
  font-weight: 700;
}

.admin-form input:not([type="checkbox"]) {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #bfcbd6;
  border-radius: 7px;
}

.admin-form input:focus {
  border-color: #17699f;
  outline: none;
  box-shadow: 0 0 0 3px rgba(23, 105, 159, 0.14);
}

.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 9px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.choice-card {
  display: flex !important;
  align-items: flex-start;
  gap: 10px;
  margin: 0 !important;
  padding: 12px;
  border: 1px solid #dbe3ea;
  border-radius: 7px;
  background: #fbfcfd;
}

.choice-card input {
  margin-top: 3px;
}

.choice-card small {
  margin-top: 3px;
  font-weight: 500;
}

.immutable-value {
  display: block;
  padding: 10px 12px;
  border-radius: 7px;
  background: #f2f5f8;
}

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

.form-actions button,
.compact-form button {
  padding: 0 18px;
}

.password-reset {
  margin-top: 32px;
  border-color: #e4c7a0;
  background: #fffdf8;
}

.password-reset h2 {
  margin-top: 0;
}

.compact-form {
  gap: 4px;
}

.compact-form button {
  justify-self: start;
  margin-top: 16px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 520px) {
  .auth-shell {
    padding: 16px;
  }

  .auth-card {
    padding: 30px 22px;
  }

  .company-shell {
    padding: 16px;
  }

  .company-panel {
    padding: 30px 22px;
  }

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

  .company-card {
    min-height: 250px;
    padding: 22px 18px;
  }

  .company-logo,
  .identity-logo {
    height: 96px;
  }

  .active-company-context,
  .protected-company-context {
    padding-right: 18px;
    padding-left: 18px;
  }

  .placeholder-actions,
  .placeholder-actions form,
  .placeholder-actions button,
  .placeholder-actions .link-button {
    width: 100%;
  }

  .admin-shell {
    padding: 14px;
  }

  .admin-panel {
    padding: 22px 16px;
  }

  .admin-header,
  .admin-header > div {
    align-items: flex-start;
    flex-direction: column;
  }

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