:root {
  --bg: #eef2f7;
  --bg-soft: #f7f9fc;
  --panel: rgba(255, 255, 255, 0.76);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --line: rgba(15, 23, 42, 0.08);
  --line-strong: rgba(15, 23, 42, 0.15);
  --text: #0f172a;
  --muted: #5f6c84;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --green: #0f9f6e;
  --green-soft: rgba(15, 159, 110, 0.12);
  --amber: #d97706;
  --amber-soft: rgba(217, 119, 6, 0.12);
  --red: #dc2626;
  --red-soft: rgba(220, 38, 38, 0.12);
  --shadow: 0 14px 34px rgba(148, 163, 184, 0.14);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  font-family: "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
}

/* VIP homepage: only active for users granted VIP access by an administrator. */
body.vip-home-mode {
  background:
    radial-gradient(circle at 14% 8%, rgba(202, 154, 55, 0.16), transparent 25%),
    radial-gradient(circle at 86% 12%, rgba(255, 224, 151, 0.08), transparent 20%),
    linear-gradient(145deg, #05080e 0%, #0a1421 46%, #080b10 100%);
}

body.vip-home-mode .app-shell { max-width: 1360px; padding-top: 24px; }
body.vip-home-mode .home-screen { gap: 18px; min-height: calc(100vh - 48px); padding: 0 0 34px; }
body.vip-home-mode .home-screen::before {
  background:
    linear-gradient(115deg, transparent 0 48%, rgba(255, 218, 130, 0.035) 49%, transparent 50%),
    radial-gradient(circle at 50% -10%, rgba(255, 220, 133, 0.12), transparent 34%);
}
body.vip-home-mode .home-screen::after { display: none; }
.vip-home-hero[hidden] { display: none !important; }

.vip-home-hero {
  position: relative;
  min-height: 286px;
  overflow: hidden;
  padding: 26px 320px 30px 34px;
  border: 1px solid rgba(226, 185, 96, 0.38);
  border-radius: 32px;
  background:
    radial-gradient(circle at 22% 55%, rgba(227, 179, 74, 0.2), transparent 25%),
    radial-gradient(circle at 78% 18%, rgba(255, 235, 178, 0.08), transparent 22%),
    linear-gradient(135deg, rgba(19, 25, 34, 0.98), rgba(6, 10, 17, 0.98));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.42), inset 0 1px rgba(255, 245, 210, 0.12);
  color: #fff7dc;
}

.vip-home-hero::before,
.vip-home-hero::after { content: ""; position: absolute; pointer-events: none; }
.vip-home-hero::before {
  inset: 0;
  opacity: 0.26;
  background: repeating-linear-gradient(118deg, transparent 0 92px, rgba(227, 184, 92, 0.1) 93px, transparent 94px);
}
.vip-home-hero::after {
  right: -90px;
  bottom: -175px;
  width: 520px;
  height: 520px;
  border: 1px solid rgba(229, 190, 105, 0.19);
  border-radius: 50%;
  box-shadow: 0 0 0 42px rgba(229, 190, 105, 0.025), 0 0 0 84px rgba(229, 190, 105, 0.02);
}

.vip-home-topline { position: relative; z-index: 2; display: flex; align-items: center; gap: 18px; margin-bottom: 26px; }
.vip-home-product { font-size: 1.15rem; font-weight: 800; letter-spacing: 0.04em; }
.vip-home-topline::after { content: ""; width: 120px; height: 1px; background: linear-gradient(90deg, #d8aa50, transparent); }
.vip-home-member {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid rgba(236, 198, 112, 0.35);
  border-radius: 999px;
  background: rgba(226, 177, 67, 0.08);
  color: #ecc974;
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.12em;
}
.vip-home-member i { font-size: 1rem; font-style: normal; }

.vip-home-identity { position: relative; z-index: 2; display: flex; align-items: center; gap: 28px; }
.vip-home-avatar {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 126px;
  width: 126px;
  height: 126px;
  border: 3px solid #e9c36d;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, #596273, #101620 68%);
  box-shadow: 0 0 0 9px rgba(225, 179, 77, 0.09), 0 0 42px rgba(221, 171, 58, 0.23);
  color: #f6d98e;
  font-family: Georgia, "Microsoft YaHei", serif;
  font-size: 3.2rem;
  font-weight: 800;
}
.vip-home-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.vip-home-crown {
  position: absolute;
  top: -28px;
  left: 50%;
  z-index: 2;
  color: #f2cb6c;
  font-size: 2.3rem;
  line-height: 1;
  text-shadow: 0 4px 16px rgba(244, 190, 65, 0.45);
  transform: translateX(-50%);
}

.vip-home-copy p, .vip-home-copy h1, .vip-home-copy h2, .vip-home-copy > span { margin: 0; }
.vip-home-copy p { margin-bottom: 7px; color: #c7a75e; font-size: 0.7rem; font-weight: 850; letter-spacing: 0.22em; }
.vip-home-copy h1 {
  color: #f9e8b8;
  font-family: Georgia, "Songti SC", "Microsoft YaHei", serif;
  font-size: clamp(1.55rem, 3vw, 2.6rem);
  font-weight: 650;
  line-height: 1.05;
}
.vip-home-copy h2 { margin: 8px 0 12px; color: #fff9e8; font-size: clamp(1.7rem, 3.2vw, 2.85rem); letter-spacing: 0.08em; line-height: 1.05; }
.vip-home-copy > span { color: #aeb4bc; font-size: 0.82rem; letter-spacing: 0.12em; }
.vip-home-shine {
  position: absolute;
  right: 80px;
  top: 64px;
  width: 130px;
  height: 130px;
  border: 1px solid rgba(235, 199, 117, 0.32);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(238, 202, 119, 0.12), transparent 64%);
  box-shadow: 0 0 0 18px rgba(232, 191, 99, 0.025), 0 0 70px rgba(236, 194, 95, 0.12);
}
.vip-home-shine::after {
  content: "888";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(239, 207, 134, 0.4);
  font-family: Georgia, serif;
  font-size: 2rem;
  font-weight: 800;
}

body.vip-home-mode .home-app-grid { width: 100%; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 15px; padding: 12px 4px 0; }
.vip-grid-heading { grid-column: 1 / -1; display: flex; align-items: end; justify-content: space-between; padding: 8px 4px 2px; color: #f7e7ba; }
.vip-grid-heading span, .vip-grid-heading h3, .vip-grid-heading p { margin: 0; }
.vip-grid-heading span { color: #b38c43; font-size: 0.62rem; font-weight: 850; letter-spacing: 0.2em; }
.vip-grid-heading h3 { margin-top: 3px; font-size: 1.25rem; }
.vip-grid-heading p { color: #827967; font-size: 0.72rem; letter-spacing: 0.18em; }
.vip-company-heading { margin-top: 12px; padding-top: 18px; border-top: 1px solid rgba(221, 184, 99, 0.15); }

body.vip-home-mode .home-app-feature {
  grid-column: span 2;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  justify-items: start;
  gap: 15px;
  width: 100%;
  min-height: 96px;
  padding: 15px 16px;
  border: 1px solid rgba(218, 184, 110, 0.23);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(26, 33, 44, 0.94), rgba(12, 17, 24, 0.96));
  box-shadow: inset 0 1px rgba(255, 250, 230, 0.06), 0 14px 34px rgba(0, 0, 0, 0.2);
  text-align: left;
}
body.vip-home-mode .home-app-feature:hover { border-color: rgba(233, 199, 121, 0.5); background: linear-gradient(135deg, rgba(35, 42, 53, 0.98), rgba(15, 20, 27, 0.98)); box-shadow: inset 0 1px rgba(255, 250, 230, 0.1), 0 18px 38px rgba(0, 0, 0, 0.3); }
body.vip-home-mode .home-app-feature .app-icon-tile {
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 230, 172, 0.22);
  border-radius: 18px;
  background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.16), transparent 36%), linear-gradient(145deg, #7c5a19, #c39535);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.24), 0 10px 22px rgba(0, 0, 0, 0.28);
}
body.vip-home-mode .home-app-feature .app-icon-mark { color: #fff6d7; }
.app-icon-copy { display: contents; }
.app-icon-copy small, .vip-app-arrow { display: none; }
body.vip-home-mode .home-app-feature .app-icon-copy { display: grid; gap: 5px; min-width: 0; }
body.vip-home-mode .home-app-feature .app-icon-label { color: #fff7df; font-size: 1rem; font-weight: 780; text-align: left; text-shadow: none; }
body.vip-home-mode .home-app-feature .app-icon-copy small { display: block; overflow: hidden; color: #8e949e; font-size: 0.7rem; text-overflow: ellipsis; white-space: nowrap; }
body.vip-home-mode .home-app-feature .vip-app-arrow { display: block; color: #c9a658; font-family: Georgia, serif; font-size: 1.8rem; font-weight: 400; }
body.vip-home-mode .home-app-feature .app-icon-shift-badge { bottom: 2px; font-size: 0.48rem; }

body.vip-home-mode .home-app-company { width: 100%; min-height: 104px; padding: 12px 6px; border: 1px solid rgba(224, 191, 117, 0.12); border-radius: 18px; background: rgba(255, 255, 255, 0.025); }
body.vip-home-mode .home-app-company:hover { border-color: rgba(224, 191, 117, 0.3); background: rgba(255, 255, 255, 0.05); }
body.vip-home-mode .home-app-company .app-icon-tile { border: 1px solid rgba(255, 227, 163, 0.18); box-shadow: inset 0 1px rgba(255, 255, 255, 0.22), 0 9px 20px rgba(0, 0, 0, 0.3); filter: saturate(0.62) brightness(0.86); }
body.vip-home-mode .home-app-company .app-icon-label { color: #d8d1c1; text-shadow: none; }

body.vip-home-mode .auth-session-bar { border-color: rgba(231, 196, 119, 0.34); background: rgba(12, 17, 24, 0.9); color: #fff4d3; box-shadow: 0 18px 46px rgba(0, 0, 0, 0.4); backdrop-filter: blur(18px); }
body.vip-home-mode .auth-session-meta span { color: #a99976; }
body.vip-home-mode .auth-profile-button, body.vip-home-mode .auth-session-button { border: 1px solid rgba(228, 190, 104, 0.2); background: rgba(213, 168, 68, 0.1); color: #e8c66f; }
body.vip-home-mode .auth-session-avatar { border-color: #dfb85f; background: linear-gradient(145deg, #2c3542, #9a7021); }

@media (max-width: 1040px) {
  .vip-home-hero { padding-right: 250px; }
  .vip-home-shine { right: 55px; }
  body.vip-home-mode .home-app-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  body.vip-home-mode .home-app-feature { grid-column: span 2; }
}

@media (max-width: 720px) {
  body.vip-home-mode .app-shell { padding: 12px 10px 26px; }
  body.vip-home-mode .home-screen { padding-top: 72px; }
  .vip-home-hero { min-height: 0; padding: 22px 20px 24px; border-radius: 25px; }
  .vip-home-topline { margin-bottom: 24px; }
  .vip-home-identity { gap: 18px; }
  .vip-home-avatar { flex-basis: 88px; width: 88px; height: 88px; font-size: 2.25rem; }
  .vip-home-crown { top: -20px; font-size: 1.8rem; }
  .vip-home-copy h1 { font-size: 1.25rem; }
  .vip-home-copy h2 { font-size: 1.55rem; }
  .vip-home-copy > span, .vip-home-shine { display: none; }
  body.vip-home-mode .home-app-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 8px 0 0; }
  body.vip-home-mode .home-app-feature { grid-column: span 1; grid-template-columns: 52px minmax(0, 1fr); min-height: 84px; padding: 12px; }
  body.vip-home-mode .home-app-feature .app-icon-tile { width: 48px; height: 48px; }
  body.vip-home-mode .home-app-feature .vip-app-arrow, body.vip-home-mode .home-app-feature .app-icon-copy small { display: none; }
  body.vip-home-mode .home-app-company { min-height: 98px; }
  .vip-grid-heading p { display: none; }
}

@media (max-width: 430px) {
  .vip-home-member, .vip-home-topline::after { display: none; }
  .vip-home-identity { align-items: flex-start; }
  .vip-home-copy p { letter-spacing: 0.1em; }
  body.vip-home-mode .home-app-feature { grid-column: 1 / -1; }
}

* {
  box-sizing: border-box;
}

@keyframes viewFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes badgePulse {
  0% {
    transform: scale(1);
  }

  45% {
    transform: scale(1.08);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes completeCard {
  from {
    opacity: 1;
    transform: scale(1);
  }

  to {
    opacity: 0;
    transform: scale(0.96);
  }
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.08), transparent 24%),
    linear-gradient(135deg, #8f848c 0%, #b99ba2 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  max-width: 1480px;
  margin: 0 auto;
  padding: 16px 18px 44px;
}

.panel-heading h2,
.sub-heading h3,
.empty-state h3 {
  margin: 0;
}

.eyebrow,
.section-label {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.nav-button,
button,
.import-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.nav-button {
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--text);
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.68);
  box-shadow: 0 10px 22px rgba(148, 163, 184, 0.12);
}

.nav-button.is-active {
  color: #fff;
  background: linear-gradient(135deg, #1d4ed8, #38bdf8);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.25);
}

button:hover,
.import-button:hover {
  transform: translateY(-1px);
}

.view-stack {
  margin-top: 0;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
  animation: viewFadeIn 180ms ease-out;
}

.panel {
  padding: 24px;
  border-radius: var(--radius-xl);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.64);
  box-shadow: var(--shadow);
}

.view-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.view-switch {
  display: inline-flex;
  gap: 10px;
}

.module-switch {
  display: inline-flex;
  gap: 10px;
  padding: 8px;
  margin-bottom: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.34);
}

.module-button {
  min-height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  border: 0;
  box-shadow: none;
  font-weight: 700;
}

.module-button.is-active {
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
}

.panel-heading,
.sub-heading,
.cycle-toolbar,
.cycle-nav,
.backup-actions,
.home-columns,
.info-strip,
.mini-stats,
.settings-grid,
.form-actions,
.inline-form,
.filters {
  display: grid;
  gap: 16px;
}

.panel-heading,
.sub-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.panel-heading {
  margin-bottom: 20px;
}

.compact-subheading {
  margin: 18px 0 10px;
}

.toast-region {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 40;
  display: grid;
  gap: 12px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  background: rgba(15, 23, 42, 0.9);
  color: #ffffff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.22);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: auto;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-message {
  flex: 1;
  font-size: 0.92rem;
  font-weight: 600;
}

.toast-action {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 700;
}

.muted-text {
  color: var(--muted);
}

.info-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
}

.compact-strip {
  margin: 18px 0 20px;
}

.info-card,
.mini-stat,
.sub-panel,
.cycle-badge,
.company-card {
  border-radius: var(--radius-lg);
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.72);
}

.info-card,
.mini-stat,
.cycle-badge {
  padding: 18px;
}

.info-card span,
.mini-stat span,
.cycle-badge span,
.company-card p,
.list-item p {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.info-card strong,
.mini-stat strong,
.cycle-badge strong {
  display: block;
  margin-top: 10px;
  font-size: 1.9rem;
  line-height: 1;
}

.home-screen {
  position: relative;
  isolation: isolate;
  min-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 28px;
  padding: 72px 0 8px;
}

.home-screen::before,
.home-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.home-screen::before {
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 255, 255, 0.1), transparent 18%),
    radial-gradient(circle at 78% 14%, rgba(255, 255, 255, 0.08), transparent 16%);
}

.home-screen::after {
  width: min(920px, 100%);
  height: min(720px, calc(100vh - 80px));
  margin: 0 auto;
  border-radius: 38px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.mtool-home-brand {
  display: flex;
  align-items: center;
  align-self: center;
  gap: 18px;
  min-width: 290px;
  padding: 18px 28px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 18px 44px rgba(62, 43, 54, 0.15);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.mtool-home-brand img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 10px 14px rgba(37, 99, 235, 0.24));
}

.mtool-home-brand h1 {
  margin: 0;
  color: #11284f;
  font-size: 2.15rem;
  line-height: 1;
  letter-spacing: -0.045em;
}

.mtool-home-brand p {
  margin: 7px 0 0;
  color: #65738a;
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.home-app-grid {
  width: min(100%, 800px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(6, 74px);
  grid-auto-rows: min-content;
  gap: 28px 38px;
  justify-items: center;
  justify-content: center;
  align-content: start;
  padding: 42px 28px 36px;
}

.app-error-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 200;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(127, 29, 29, 0.94);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.18);
}

.home-app {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: 74px;
  background: transparent;
  box-shadow: none;
  border: 0;
  padding: 0;
  transition: transform 140ms ease;
}

.home-app:hover {
  transform: translateY(-2px);
}

.home-app.is-selected .app-icon-tile {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.46),
    0 0 0 2px rgba(255, 255, 255, 0.66),
    0 10px 18px rgba(15, 23, 42, 0.16);
}

.app-icon-tile {
  position: relative;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 14px;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.26), transparent 34%),
    linear-gradient(145deg, var(--app-a, #60a5fa), var(--app-b, #2563eb));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.46),
    0 6px 12px rgba(15, 23, 42, 0.12);
  overflow: hidden;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.app-icon-tile::after {
  content: "";
  position: absolute;
  inset: auto -16px -18px auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
}

.app-icon-mark {
  position: relative;
  z-index: 1;
  font-size: 1.38rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.04em;
}

.app-icon-badge {
  position: absolute;
  left: 4px;
  top: 4px;
  z-index: 1;
  min-height: 16px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.24);
  color: #fff;
  font-size: 0.58rem;
  font-weight: 700;
  transition: transform 140ms ease, background 140ms ease;
}

.app-icon-pin {
  position: absolute;
  right: 4px;
  top: 4px;
  z-index: 1;
  min-height: 16px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #0f172a;
  font-size: 0.52rem;
  font-weight: 800;
}

.app-icon-badge-active {
  background: rgba(16, 185, 129, 0.92);
  color: #ffffff;
}

.app-icon-shift-badge {
  position: absolute;
  left: 50%;
  bottom: 4px;
  z-index: 2;
  max-width: calc(100% - 8px);
  min-height: 16px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(5, 150, 105, 0.94);
  color: #ffffff;
  font-size: 0.54rem;
  font-weight: 800;
  line-height: 14px;
  white-space: nowrap;
  transform: translateX(-50%);
  box-shadow: 0 3px 8px rgba(5, 150, 105, 0.3);
}

.app-icon-shift-badge-pulse {
  animation: activeShiftPulse 420ms ease-out;
}

.app-icon-badge-pulse {
  animation: badgePulse 160ms ease-out;
}

.home-app:hover .app-icon-tile {
  transform: translateY(-1px) scale(1.01);
}

.home-app:hover .app-icon-badge {
  transform: scale(1.05);
}

@keyframes activeShiftPulse {
  0% { transform: translateX(-50%) scale(0.72); }
  65% { transform: translateX(-50%) scale(1.12); }
  100% { transform: translateX(-50%) scale(1); }
}

.app-icon-label {
  max-width: 100%;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-shadow: 0 1px 3px rgba(15, 23, 42, 0.42);
  white-space: normal;
  word-break: break-word;
}

.home-app[data-open-settings="true"] .app-icon-tile {
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.26), transparent 34%),
    linear-gradient(145deg, #374151, #111827);
}

.records-layout {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 20px;
  margin-bottom: 20px;
}

.mini-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.sub-panel {
  padding: 18px;
}

.roster-list,
.activity-list,
.settings-list {
  display: grid;
  gap: 12px;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  box-shadow: 0 4px 12px rgba(148, 163, 184, 0.06);
}

.list-item-clickable {
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.list-item-clickable:hover {
  border-color: rgba(37, 99, 235, 0.22);
  background: rgba(255, 255, 255, 0.92);
}

.list-item-clickable.is-completing {
  animation: completeCard 180ms ease-out forwards;
  pointer-events: none;
}

.list-item h4 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.inline-chip {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  vertical-align: middle;
}

.night-shift-chip,
.company-shift-label {
  background: rgba(124, 58, 237, 0.12);
  color: #6d28d9;
}

.company-shift-label {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  margin-left: 5px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 800;
  vertical-align: 1px;
}

.tag-badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.tag-badge {
  background: var(--accent-soft);
  color: var(--accent);
}

.status-active {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-overdue {
  background: var(--red-soft);
  color: var(--red);
}

.status-returned {
  background: var(--green-soft);
  color: var(--green);
}

.record-form {
  display: grid;
  gap: 16px;
}

.settings-grid > .panel .panel-heading {
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.settings-grid > .panel .panel-heading h2 {
  letter-spacing: -0.02em;
}

.settings-panel .panel-heading {
  align-items: center;
  margin-bottom: 0;
}

.settings-panel-toggle {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.14);
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 700;
}

.settings-panel-body {
  display: grid;
  gap: 16px;
  padding-top: 18px;
}

.settings-panel.is-collapsed .panel-heading {
  padding-bottom: 0;
  border-bottom: 0;
}

.settings-panel.is-collapsed .settings-panel-body {
  display: none;
}

.settings-list .list-item {
  background: rgba(255, 255, 255, 0.9);
}

.module-section {
  display: none;
}

.module-section.is-active {
  display: block;
  animation: viewFadeIn 180ms ease-out;
}

.record-form label,
.filters label {
  display: grid;
  gap: 8px;
}

.record-form span,
.filters span {
  font-size: 0.92rem;
  font-weight: 700;
}

.record-form .auth-sms-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.72);
}

.record-form .auth-sms-toggle input {
  width: 20px;
  min-height: 20px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.record-form .auth-sms-toggle span {
  display: grid;
  gap: 4px;
}

.record-form .auth-sms-toggle strong {
  color: var(--text);
}

.record-form .auth-sms-toggle small {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.45;
}

.auth-notification-options {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.84), rgba(239, 247, 255, 0.68));
}

.auth-notification-options legend {
  padding: 0 6px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 800;
}

.auth-notification-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.record-form .auth-notification-grid label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(82, 116, 154, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
}

.auth-notification-grid input {
  width: 19px;
  min-height: 19px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.auth-notification-grid span {
  display: grid;
  gap: 3px;
}

.auth-notification-grid strong {
  color: var(--text);
}

.auth-notification-grid small,
.auth-notification-hint {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.45;
}

.auth-permission-options {
  margin: 0;
  padding: 16px;
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(239, 246, 255, 0.96), rgba(236, 253, 245, 0.88));
}

.auth-vip-access-toggle {
  margin: 2px 0 14px;
  border-color: rgba(190, 139, 31, 0.3);
  background: linear-gradient(135deg, rgba(255, 249, 226, 0.9), rgba(255, 255, 255, 0.96));
}

.auth-vip-access-toggle strong,
.auth-vip-chip {
  color: #9a6500;
}

.auth-vip-chip {
  border-color: rgba(190, 139, 31, 0.28) !important;
  background: #fff6d8 !important;
  font-weight: 800;
}

.auth-permission-options legend {
  padding: 0 7px;
  color: var(--text);
  font-weight: 850;
}

.auth-permission-options > p,
.auth-permission-options > small {
  display: block;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.auth-permission-options > small {
  margin: 12px 0 0;
}

.auth-permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.record-form .auth-permission-grid label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 66px;
  padding: 11px;
  border: 1px solid rgba(82, 116, 154, 0.15);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
}

.auth-permission-grid input {
  width: 20px;
  min-height: 20px;
  margin-top: 2px;
  accent-color: #2563eb;
}

.auth-permission-grid span {
  display: grid;
  gap: 3px;
}

.auth-permission-grid strong {
  color: var(--text);
  font-size: 0.9rem;
}

.auth-permission-grid small,
.auth-user-permission-summary {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.auth-user-permission-summary {
  color: #2563eb !important;
  font-weight: 700;
}

.auth-notification-hint {
  display: block;
  margin-top: 10px;
}

.auth-account-toolbar {
  display: grid;
  grid-template-columns: auto auto auto minmax(220px, 1fr) minmax(150px, 0.35fr);
  gap: 12px;
  align-items: end;
  padding: 14px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(232, 244, 255, 0.9), rgba(239, 250, 246, 0.82));
  border: 1px solid rgba(37, 99, 235, 0.1);
}

.auth-account-search,
.auth-account-filter {
  display: grid;
  gap: 6px;
}

.auth-account-search span,
.auth-account-filter span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.auth-user-modal-open {
  overflow: hidden;
}

.auth-user-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-user-modal-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: rgba(32, 43, 56, 0.42);
  backdrop-filter: blur(12px);
}

.auth-user-modal-card {
  position: relative;
  width: min(780px, 100%);
  max-height: min(880px, calc(100vh - 40px));
  overflow: auto;
  padding: 24px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  background:
    radial-gradient(circle at 90% 0%, rgba(77, 181, 255, 0.13), transparent 34%),
    rgba(249, 251, 253, 0.98);
  box-shadow: 0 32px 90px rgba(22, 39, 57, 0.26);
  animation: authModalIn 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.quick-lending-modal-card {
  width: min(560px, 100%);
}

.quick-lending-form {
  gap: 16px;
}

.quick-lending-form input[readonly] {
  color: var(--text);
  background: rgba(235, 241, 247, 0.78);
}

.quick-lending-actions {
  justify-content: flex-end;
}

.open-lending-modal-card {
  width: min(760px, 100%);
}

.open-lending-list {
  display: grid;
  gap: 12px;
}

.open-lending-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.84);
}

.open-lending-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.open-lending-copy strong {
  font-size: 1.04rem;
}

.open-lending-copy span,
.open-lending-copy small {
  color: var(--muted);
}

.open-lending-controls {
  display: flex;
  align-items: center;
  gap: 9px;
}

.open-lending-controls input[type="time"] {
  width: 132px;
}

.open-lending-empty {
  margin: 0;
}

@media (max-width: 620px) {
  .open-lending-row {
    grid-template-columns: 1fr;
    gap: 13px;
  }

  .open-lending-controls input[type="time"],
  .open-lending-controls .primary-button {
    flex: 1 1 0;
    width: auto;
  }
}

@keyframes authModalIn {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-user-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.auth-user-modal-header h3 {
  margin: 3px 0 6px;
  font-size: clamp(1.45rem, 3vw, 2rem);
}

.auth-user-modal-header p:last-child {
  margin: 0;
  color: var(--muted);
}

.auth-user-modal-close {
  flex: 0 0 auto;
  width: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 1.5rem;
}

.auth-template-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: -2px;
}

.auth-template-heading span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.auth-role-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.auth-role-picker button {
  display: grid;
  gap: 4px;
  min-height: 74px;
  padding: 13px;
  text-align: left;
  border-radius: 16px;
  border: 1px solid rgba(74, 102, 133, 0.14);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
}

.auth-role-picker button small {
  color: var(--muted);
  font-size: 0.76rem;
}

.auth-role-picker button.is-selected {
  border-color: rgba(15, 143, 210, 0.55);
  background: linear-gradient(145deg, rgba(220, 243, 255, 0.96), rgba(226, 249, 239, 0.9));
  box-shadow: inset 0 0 0 1px rgba(15, 143, 210, 0.12), 0 8px 18px rgba(25, 125, 175, 0.1);
}

.auth-essential-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.auth-worker-setup {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(20, 158, 112, 0.15);
  background: rgba(231, 249, 241, 0.66);
}

.auth-worker-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.84);
}

.auth-worker-mode button {
  min-height: 40px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
}

.auth-worker-mode button.is-selected {
  background: #123c4a;
  color: #fff;
  box-shadow: 0 6px 14px rgba(18, 60, 74, 0.18);
}

.auth-password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: end;
}

.auth-advanced-details {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
  overflow: hidden;
}

.auth-advanced-details summary {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 16px;
  cursor: pointer;
  color: var(--text);
  font-weight: 800;
  list-style: none;
}

.auth-advanced-details summary::-webkit-details-marker {
  display: none;
}

.auth-advanced-details summary span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.auth-advanced-body {
  display: grid;
  gap: 14px;
  padding: 0 16px 16px;
}

.auth-modal-actions {
  display: flex;
  justify-content: flex-end;
}

.auth-user-group {
  display: grid;
  gap: 9px;
}

.auth-user-group + .auth-user-group {
  margin-top: 8px;
}

.auth-user-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.auth-user-group-header h3 {
  margin: 0;
  font-size: 0.92rem;
}

.auth-user-group-header span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.auth-user-group-list {
  display: grid;
  gap: 9px;
}

.auth-user-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
}

.auth-user-card.is-inactive {
  opacity: 0.64;
}

.auth-user-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  background: linear-gradient(145deg, #d9f2ff, #dff7eb);
  color: #08698e;
  font-size: 1.15rem;
  font-weight: 900;
}

.auth-user-card-copy h4 {
  margin: 0 0 3px;
}

.auth-user-card-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.auth-user-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.auth-user-card-tags span {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.09);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.auth-user-card-tags .is-active {
  background: var(--green-soft);
  color: var(--green);
}

.auth-user-card-tags .is-inactive {
  background: var(--red-soft);
  color: var(--red);
}

.auth-account-more {
  position: relative;
}

.auth-account-more summary {
  min-height: 34px;
  padding: 8px 11px;
  border-radius: 10px;
  background: rgba(100, 116, 139, 0.09);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
  list-style: none;
}

.auth-account-more summary::-webkit-details-marker {
  display: none;
}

.auth-account-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 7px);
  right: 0;
  display: grid;
  min-width: 150px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 36px rgba(23, 38, 55, 0.18);
}

.auth-account-menu button {
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.auth-account-menu button:hover {
  background: rgba(30, 136, 190, 0.08);
}

.auth-account-menu .danger-button {
  color: var(--red);
}

.auth-bulk-modal-card {
  width: min(980px, 100%);
}

.auth-bulk-form,
.auth-bulk-source,
.auth-invite-form {
  display: grid;
  gap: 14px;
}

.auth-bulk-source {
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 0.45fr) auto;
  align-items: end;
}

.auth-bulk-source label:first-child {
  grid-row: span 2;
}

.auth-bulk-source textarea {
  min-height: 128px;
}

.auth-bulk-rows {
  display: grid;
  gap: 9px;
}

.auth-bulk-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(150px, 1fr) minmax(120px, 0.8fr) minmax(110px, 0.65fr) auto;
  gap: 8px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.82);
}

.auth-bulk-row label {
  display: grid;
  gap: 5px;
}

.auth-bulk-row label span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
}

.auth-bulk-remove {
  width: 40px;
  min-height: 42px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid rgba(220, 38, 38, 0.12);
  background: var(--red-soft);
  color: var(--red);
  font-weight: 900;
}

.auth-bulk-empty {
  padding: 22px;
  border: 1px dashed rgba(60, 95, 125, 0.22);
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
}

.auth-bulk-success {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 20px;
  background: rgba(232, 250, 242, 0.88);
}

.auth-bulk-success h3,
.auth-bulk-success p {
  margin: 0;
}

.auth-bulk-success p {
  color: var(--muted);
}

.auth-bulk-success textarea {
  min-height: 180px;
  background: #fff;
}

.auth-invite-modal-card {
  width: min(720px, 100%);
}

.auth-invite-form {
  grid-template-columns: minmax(220px, 1fr) minmax(130px, 0.35fr) auto;
  align-items: end;
}

.auth-invite-result {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  margin: 20px 0;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(15, 143, 210, 0.18);
  background: linear-gradient(145deg, rgba(225, 245, 255, 0.9), rgba(231, 250, 241, 0.86));
}

.auth-invite-result img {
  width: 176px;
  height: 176px;
  padding: 9px;
  border-radius: 18px;
  background: #fff;
}

.auth-invite-result h4,
.auth-invite-result p {
  margin: 0 0 9px;
}

.auth-invite-result p {
  color: var(--muted);
}

.auth-invite-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.auth-invite-card h4,
.auth-invite-card p {
  margin: 0;
}

.auth-invite-card p {
  color: var(--muted);
  font-size: 0.82rem;
}

@media (max-width: 640px) {
  .auth-notification-grid,
  .auth-permission-grid {
    grid-template-columns: 1fr;
  }

  .auth-account-toolbar,
  .auth-essential-grid,
  .auth-role-picker {
    grid-template-columns: 1fr 1fr;
  }

  .auth-account-toolbar .secondary-button,
  .auth-account-search {
    grid-column: 1 / -1;
  }

  .auth-account-toolbar .secondary-button {
    width: 100%;
  }

  .auth-user-modal {
    align-items: end;
    padding: 0;
  }

  .auth-user-modal-card {
    width: 100%;
    max-height: 94vh;
    padding: 20px 16px;
    border-radius: 28px 28px 0 0;
  }

  .auth-role-picker button {
    min-height: 68px;
  }

  .auth-password-row {
    grid-template-columns: 1fr;
  }

  .auth-bulk-source,
  .auth-invite-form,
  .auth-invite-result {
    grid-template-columns: 1fr;
  }

  .auth-bulk-source label:first-child {
    grid-row: auto;
  }

  .auth-bulk-row {
    grid-template-columns: 1fr 1fr;
  }

  .auth-bulk-row label:first-child,
  .auth-bulk-row label:nth-child(2) {
    grid-column: 1 / -1;
  }

  .auth-bulk-remove {
    justify-self: end;
  }

  .auth-invite-result img {
    justify-self: center;
  }

  .auth-user-card {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .auth-user-avatar {
    width: 44px;
    height: 44px;
  }

  .auth-user-card-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .auth-account-menu {
    position: fixed;
    right: 16px;
    bottom: 16px;
    top: auto;
    left: 16px;
  }
}

.input-with-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.32);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

textarea {
  resize: vertical;
  min-height: 104px;
}

input[readonly] {
  background: rgba(241, 245, 249, 0.86);
}

.form-grid,
.filters,
.settings-grid {
  display: grid;
  gap: 16px;
}

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

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

.inline-form {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.primary-button {
  background: linear-gradient(135deg, #1d4ed8, #38bdf8);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 16px 28px rgba(37, 99, 235, 0.2);
}

.secondary-button {
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  border: 1px solid var(--line);
  font-weight: 700;
}

.ghost-button {
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.compact-button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.68);
  white-space: nowrap;
}

.primary-button:hover,
.secondary-button:hover,
.action-button:hover,
.compact-button:hover {
  box-shadow: 0 6px 14px rgba(148, 163, 184, 0.1);
}

.form-hint {
  margin: 16px 0 0;
}

.cycle-toolbar {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.cycle-nav {
  grid-template-columns: auto 1fr auto;
  align-items: center;
}

.cycle-badge {
  text-align: center;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.22);
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.42);
}

.hours-date-group-row:hover {
  background: transparent;
}

.hours-date-group-row td {
  padding: 10px 0 6px;
  border-bottom: 0;
}

.hours-date-toggle {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  width: 100%;
  min-height: 54px;
  gap: 10px;
  padding: 10px 16px;
  border: 1px solid rgba(59, 130, 246, 0.12);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(239, 246, 255, 0.78));
  color: var(--text);
  text-align: left;
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.04);
}

.hours-date-toggle:hover {
  border-color: rgba(59, 130, 246, 0.24);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.08);
}

.hours-date-toggle strong {
  font-size: 0.95rem;
}

.hours-date-summary {
  justify-self: end;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.hours-date-chevron {
  width: 9px;
  height: 9px;
  border-right: 2px solid #3b82f6;
  border-bottom: 2px solid #3b82f6;
  transform: rotate(-45deg);
  transition: transform 160ms ease;
}

.hours-date-toggle[aria-expanded="true"] .hours-date-chevron {
  transform: rotate(45deg) translate(-2px, -2px);
}

.hours-date-entry.is-collapsed {
  display: none;
}

.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.84rem;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.action-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.night-shift-button-active {
  border-color: rgba(124, 58, 237, 0.28);
  background: rgba(124, 58, 237, 0.1);
  color: #6d28d9;
  font-weight: 700;
}

.overnight-time {
  font-weight: 700;
  color: #6d28d9;
}

.overnight-label {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-left: 7px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.12);
  color: #6d28d9;
  font-size: 0.7rem;
  font-weight: 800;
  vertical-align: middle;
}

.danger-button {
  color: var(--red);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, 0.42);
  text-align: center;
}

.empty-state p {
  margin: 10px 0 0;
  color: var(--muted);
}

.hidden {
  display: none;
}

@media (max-width: 1180px) {
  .records-layout,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .mini-stats,
  .info-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .view-toolbar,
  .panel-heading,
  .sub-heading {
    flex-direction: column;
  }

  .cycle-toolbar,
  .cycle-nav,
  .form-grid,
  .filters,
  .inline-form,
  .mini-stats,
  .info-strip,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .top-nav {
    width: 100%;
  }

  .view-switch {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .view-switch .nav-button {
    width: 100%;
  }

  .home-app-grid {
    grid-template-columns: repeat(4, 74px);
    gap: 26px 24px;
    padding: 28px 20px 24px;
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding: 14px 12px 26px;
  }

  .view-stack {
    gap: 14px;
  }

  .view-toolbar {
    position: sticky;
    top: 10px;
    z-index: 20;
    padding: 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(10px);
  }

  .module-switch {
    position: sticky;
    top: 94px;
    z-index: 19;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    margin-bottom: 14px;
    padding: 6px;
  }

  .module-button {
    width: 100%;
    justify-content: center;
  }

  .toast-region {
    left: 12px;
    right: 12px;
    top: 12px;
  }

  .toast {
    min-width: 0;
    max-width: none;
  }

  .panel {
    padding: 18px;
    border-radius: 24px;
  }

  .records-layout {
    gap: 14px;
    margin-bottom: 14px;
  }

  .panel-heading {
    gap: 10px;
  }

  .panel-heading h2 {
    font-size: 1.55rem;
  }

  .view-toolbar,
  .view-switch,
  .backup-actions {
    width: 100%;
  }

  .view-switch {
    grid-template-columns: 1fr;
  }

  .view-switch .nav-button,
  .backup-actions .secondary-button,
  .backup-actions .import-button,
  .form-actions .primary-button,
  .form-actions .secondary-button,
  .form-actions .ghost-button {
    width: 100%;
  }

  .record-form label,
  .filters label,
  .inline-form {
    gap: 10px;
  }

  .record-form input,
  .record-form select,
  .record-form textarea,
  .filters input,
  .filters select,
  .inline-form input,
  .inline-form select {
    min-height: 48px;
    font-size: 16px;
  }

  .record-form textarea {
    min-height: 112px;
  }

  .form-actions {
    position: sticky;
    bottom: 8px;
    z-index: 8;
    padding: 10px;
    border-radius: 18px;
    background: rgba(247, 249, 252, 0.92);
    backdrop-filter: blur(10px);
  }

  .input-with-button {
    grid-template-columns: 1fr;
  }

  .compact-button {
    width: 100%;
  }

  .cycle-badge {
    text-align: left;
  }

  .mini-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .mini-stat {
    min-height: 110px;
  }

  .sub-panel {
    padding: 16px;
  }

  .list-item {
    gap: 12px;
    padding: 14px;
  }

  .table-wrap {
    margin: 0 -4px;
    background: transparent;
  }

  .table-wrap thead {
    display: none;
  }

  .table-wrap table,
  .table-wrap tbody,
  .table-wrap tr {
    display: block;
    width: 100%;
  }

  .table-wrap tr.hours-date-group-row {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .table-wrap tr.hours-date-group-row td {
    display: block;
    padding: 0;
    border: 0;
  }

  .table-wrap tr.hours-date-group-row td::before {
    display: none;
  }

  .hours-date-toggle {
    grid-template-columns: auto 1fr;
    min-height: 62px;
    padding: 12px 14px;
  }

  .hours-date-summary {
    grid-column: 2;
    justify-self: start;
  }

  .table-wrap tr.hours-date-entry.is-collapsed {
    display: none;
  }

  .table-wrap tbody {
    display: grid;
    gap: 12px;
  }

  .table-wrap tr {
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  }

  .table-wrap td {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 10px;
    padding: 8px 0;
    font-size: 0.86rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  }

  .table-wrap td:last-child {
    border-bottom: 0;
  }

  .table-wrap td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
  }

  .table-wrap td[colspan] {
    display: block;
    padding: 0;
    border-bottom: 0;
  }

  .table-wrap td[colspan]::before {
    display: none;
  }

  .record-actions {
    width: 100%;
  }

  .action-button {
    flex: 1 1 auto;
    justify-content: center;
  }

  .table-wrap .record-actions {
    justify-content: stretch;
  }

  .home-screen {
    min-height: calc(100vh - 12px);
    padding-top: 20px;
  }

  .mtool-home-brand {
    min-width: 0;
    gap: 12px;
    padding: 13px 20px;
    border-radius: 22px;
  }

  .mtool-home-brand img {
    width: 52px;
    height: 52px;
  }

  .mtool-home-brand h1 {
    font-size: 1.7rem;
  }

  .home-app-grid {
    width: min(100%, 320px);
    grid-template-columns: repeat(4, 60px);
    gap: 22px 18px;
    padding: 22px 10px 18px;
  }

  .home-app {
    width: 60px;
  }

  .app-icon-tile {
    width: 54px;
    height: 54px;
  }

  .app-icon-label {
    font-size: 0.78rem;
  }
}

@media (max-width: 430px) {
  .app-shell {
    padding: 10px 10px 22px;
  }

  .view-toolbar {
    top: 6px;
    padding: 10px;
    border-radius: 18px;
  }

  .module-switch {
    top: 86px;
  }

  .panel {
    padding: 16px;
    border-radius: 20px;
  }

  .panel-heading h2 {
    font-size: 1.35rem;
  }

  .home-app-grid {
    width: min(100%, 288px);
    grid-template-columns: repeat(4, 56px);
    gap: 18px 14px;
    padding: 14px 6px 12px;
  }

  .home-app {
    width: 56px;
  }

  .app-icon-tile {
    width: 50px;
    height: 50px;
  }

  .app-icon-badge {
    min-width: 30px;
    min-height: 20px;
    font-size: 0.68rem;
  }
}
