:root {
  --bg: #f7f9fb;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #dbe4ee;
  --surface: rgba(255, 255, 255, 0.86);
  --teal: #0e7490;
  --teal-deep: #155e75;
  --teal-soft: #e6f6f8;
  --focus: rgba(14, 116, 144, 0.22);
  --shadow: 0 26px 80px rgba(15, 23, 42, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -20%, rgba(14, 116, 144, 0.16), transparent 36%),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 52%, #eef4f7 100%);
}

a,
button {
  font: inherit;
}

a {
  color: var(--teal-deep);
  font-weight: 650;
  text-decoration: none;
}

a:hover,
.text-link:hover {
  color: var(--teal);
}

.login-page {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px 18px;
  overflow: hidden;
}

.login-page[hidden] {
  display: none;
}

.login-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(15, 23, 42, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(15, 23, 42, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 72%, transparent);
  pointer-events: none;
}

.login-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 430px);
  border: 1px solid rgba(219, 228, 238, 0.92);
  border-radius: 30px;
  padding: clamp(26px, 5vw, 40px);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 24px;
  place-items: center;
  border-radius: 18px;
  color: #ffffff;
  background: linear-gradient(145deg, var(--teal), var(--teal-deep));
  box-shadow: 0 14px 34px rgba(14, 116, 144, 0.3);
  font-size: 18px;
  font-weight: 760;
}

.login-heading {
  margin-bottom: 28px;
  text-align: center;
}

.product-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(42px, 8vw, 56px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: 28px;
  letter-spacing: 0;
}

.login-form,
.reset-form {
  display: grid;
  gap: 16px;
}

.field-group {
  display: grid;
  gap: 8px;
}

label {
  color: #26364a;
  font-size: 13px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  font-size: 16px;
  outline: 0;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

textarea {
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  font: inherit;
  resize: vertical;
  outline: 0;
}

input::placeholder {
  color: #94a3b8;
}

input:focus {
  border-color: var(--teal);
  background: #ffffff;
  box-shadow: 0 0 0 5px var(--focus);
}

textarea:focus {
  border-color: var(--teal);
  background: #ffffff;
  box-shadow: 0 0 0 5px var(--focus);
}

select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 0 36px 0 13px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
  outline: 0;
}

.modal-copy {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.human-check {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0 15px;
  color: #26364a;
  background: rgba(248, 251, 253, 0.92);
  font-size: 14px;
  font-weight: 720;
  cursor: pointer;
  user-select: none;
}

.human-check input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.tick-box {
  position: relative;
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  border: 1.5px solid #9db3c5;
  border-radius: 7px;
  background: #ffffff;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.tick-box::after {
  content: "";
  width: 11px;
  height: 6px;
  border: solid #ffffff;
  border-width: 0 0 2px 2px;
  opacity: 0;
  transform: rotate(-45deg) translateY(-1px);
}

.human-check input:focus-visible + .tick-box {
  box-shadow: 0 0 0 5px var(--focus);
}

.human-check input:checked + .tick-box {
  border-color: var(--teal);
  background: var(--teal);
}

.human-check input:checked + .tick-box::after {
  opacity: 1;
}

.double-check {
  display: grid;
  gap: 12px;
  border-color: rgba(14, 116, 144, 0.38);
  border: 1px solid rgba(14, 116, 144, 0.38);
  border-radius: 18px;
  padding: 14px;
  background: #eef8fa;
}

.double-check[hidden] {
  display: none;
}

.double-check p {
  margin: 0;
  color: var(--teal-deep);
  font-size: 13px;
  line-height: 1.45;
  font-weight: 700;
}

.primary-action {
  min-height: 54px;
  border: 0;
  border-radius: 16px;
  padding: 0 18px;
  color: #ffffff;
  background: linear-gradient(145deg, var(--teal), var(--teal-deep));
  box-shadow: 0 16px 34px rgba(14, 116, 144, 0.24);
  font-size: 16px;
  font-weight: 760;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.primary-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 38px rgba(14, 116, 144, 0.28);
  filter: saturate(1.06);
}

.primary-action:disabled {
  color: #7b8794;
  background: #dfe7ee;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.login-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
  font-size: 14px;
}

.text-link {
  border: 0;
  padding: 0;
  color: var(--teal-deep);
  background: transparent;
  font-weight: 700;
  cursor: pointer;
}

.preview-note,
.reset-message {
  min-height: 22px;
  margin: 18px 0 0;
  color: var(--teal-deep);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
}

.security-footer {
  position: absolute;
  z-index: 1;
  bottom: 22px;
  display: flex;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
}

.security-footer span + span::before {
  content: "/";
  margin-right: 14px;
  color: #a8b3c1;
}

.modal-backdrop {
  position: fixed;
  z-index: 5;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(10px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  position: relative;
  width: min(100%, 440px);
  border: 1px solid rgba(219, 228, 238, 0.92);
  border-radius: 26px;
  padding: 32px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.back-link {
  display: block;
  margin: 18px auto 0;
}

.app-shell {
  min-height: 100vh;
  background: #f6f8fb;
}

.app-shell[hidden] {
  display: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 282px minmax(0, 1fr);
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(219, 228, 238, 0.9);
  padding: 22px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark.small {
  width: 42px;
  height: 42px;
  margin: 0;
  border-radius: 14px;
  font-size: 14px;
}

.app-brand strong,
.app-brand small {
  display: block;
}

.app-brand strong {
  font-size: 18px;
}

.app-brand small {
  color: var(--muted);
  font-size: 12px;
}

.app-nav {
  display: grid;
  gap: 6px;
}

.app-nav button,
.action-grid button,
.chip-row button,
.metric-card button,
.kanban button,
.secondary-action {
  border: 1px solid transparent;
  border-radius: 13px;
  color: #334155;
  background: transparent;
  cursor: pointer;
  font-weight: 700;
}

.app-nav button {
  min-height: 44px;
  padding: 0 13px;
  text-align: left;
}

.app-nav button:hover,
.app-nav button.active {
  color: var(--teal-deep);
  background: var(--teal-soft);
}

.app-main {
  min-width: 0;
  padding: 24px clamp(18px, 3vw, 34px) 40px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.app-header h2 {
  margin: 0;
  font-size: clamp(26px, 3vw, 38px);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.role-switcher {
  color: var(--muted);
}

.secondary-action {
  min-height: 44px;
  padding: 0 15px;
  border-color: var(--line);
  background: #ffffff;
}

.secondary-action:hover {
  border-color: rgba(14, 116, 144, 0.32);
  color: var(--teal-deep);
}

.page-content {
  display: grid;
  gap: 18px;
}

.panel,
.metric-card {
  border: 1px solid rgba(219, 228, 238, 0.94);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 16px 44px rgba(15, 23, 42, 0.07);
}

.panel {
  padding: 18px;
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.section-title h3 {
  margin: 0;
  font-size: 18px;
}

.section-title span {
  color: var(--muted);
  font-size: 13px;
}

.filter-panel,
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.filter-panel .secondary-action {
  align-self: end;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.metric-card {
  display: grid;
  gap: 12px;
  padding: 18px;
}

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

.metric-card strong {
  font-size: 34px;
}

.metric-card button,
.action-grid button,
.chip-row button,
.kanban button {
  min-height: 38px;
  padding: 0 12px;
  border-color: var(--line);
  background: #ffffff;
}

.chart-preview {
  display: flex;
  align-items: end;
  gap: 12px;
  height: 210px;
  padding: 20px;
  border-radius: 18px;
  background: linear-gradient(180deg, #f9fcfd, #eef6f8);
}

.chart-preview span {
  flex: 1;
  min-width: 22px;
  border-radius: 999px 999px 8px 8px;
  background: linear-gradient(180deg, var(--teal), #9ccfd8);
}

.chart-preview span:nth-child(1) { height: 42%; }
.chart-preview span:nth-child(2) { height: 66%; }
.chart-preview span:nth-child(3) { height: 52%; }
.chart-preview span:nth-child(4) { height: 78%; }
.chart-preview span:nth-child(5) { height: 58%; }

.action-grid,
.chip-row,
.kanban,
.tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.tabs button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--teal-deep);
  background: #ffffff;
  font-weight: 750;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

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

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

th,
td {
  border-bottom: 1px solid #e7edf4;
  padding: 13px 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #475569;
  font-size: 12px;
  text-transform: uppercase;
}

td {
  color: #26364a;
  font-size: 14px;
}

td input {
  min-height: 38px;
  max-width: 90px;
  margin: 0;
  border-radius: 12px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(80px, 1fr));
  gap: 8px;
}

.calendar-grid div,
.kanban article {
  min-height: 86px;
  border: 1px solid #e2eaf2;
  border-radius: 16px;
  padding: 12px;
  background: #fbfdfe;
}

.calendar-grid strong,
.calendar-grid span {
  display: block;
}

.calendar-grid span,
.kanban p {
  color: var(--muted);
  font-size: 13px;
}

.kanban article {
  display: grid;
  gap: 10px;
}

.kanban h3,
.kanban p {
  margin: 0;
}

@media (max-width: 520px) {
  .login-page {
    align-content: center;
    padding: 22px 14px 58px;
  }

  .login-shell {
    border-radius: 24px;
  }

  .login-actions,
  .security-footer {
    align-items: center;
    flex-direction: column;
  }

  .security-footer {
    bottom: 14px;
    gap: 4px;
  }

  .security-footer span + span::before {
    content: "";
    margin: 0;
  }
}

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

  .app-sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(219, 228, 238, 0.9);
  }

  .app-nav {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .app-header,
  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .calendar-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}
