:root {
  --bg-0: #070f17;
  --bg-1: #0d1b2a;
  --bg-2: #11263a;
  --panel: rgba(16, 37, 57, 0.86);
  --panel-border: rgba(119, 159, 194, 0.22);
  --text-main: #e4edf6;
  --text-dim: #9cb3c8;
  --accent: #2ca58d;
  --radius: 14px;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
  --font-main: "Space Grotesk", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", Consolas, monospace;
  --surface-2: rgba(9, 22, 35, 0.78);
  --surface-3: rgba(10, 24, 37, 0.62);
  --row-hover: rgba(44, 165, 141, 0.13);
  --topbar-bg: rgba(7, 17, 27, 0.93);
  --icon-btn-size: 2.45rem;
  --icon-btn-inset: 0.16rem;
  --icon-btn-ratio: 0.66;
  --icon-btn-stroke: 1.82;
  --btn-bg: color-mix(in srgb, var(--surface-2) 92%, #000 8%);
  --btn-bg-hover: color-mix(in srgb, var(--surface-2) 86%, #000 14%);
}

html[data-theme="light"] {
  --bg-0: #edf2f7;
  --bg-1: #dde7f2;
  --bg-2: #d3deea;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-border: rgba(78, 104, 130, 0.22);
  --text-main: #1f2c3a;
  --text-dim: #4a6277;
  --accent: #0d8d74;
}

html[data-theme="steel"] {
  --bg-0: #d8ecfb;
  --bg-1: #c9e2f7;
  --bg-2: #b8d9f4;
  --panel: rgba(243, 251, 255, 0.94);
  --panel-border: rgba(70, 127, 170, 0.3);
  --text-main: #12324b;
  --text-dim: #436d8f;
  --accent: #2f84c2;
  --surface-2: rgba(232, 246, 255, 0.98);
  --surface-3: rgba(219, 240, 254, 0.95);
  --row-hover: rgba(47, 132, 194, 0.14);
  --topbar-bg: rgba(231, 246, 255, 0.97);
}

html[data-style="2"] {
  --font-main: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", Consolas, monospace;
  --radius: 4px;
  --panel-border: rgba(88, 132, 171, 0.38);
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

html[data-style="4"] {
  --font-main: "PT Serif", Georgia, serif;
  --font-mono: "IBM Plex Mono", Consolas, monospace;
  --radius: 3px;
  --shadow: 0 8px 20px rgba(82, 69, 42, 0.14);
}

html[data-style="4"][data-theme="light"] {
  --bg-0: #f6f6f6;
  --bg-1: #efefef;
  --bg-2: #e8e8e8;
  --panel: rgba(255, 255, 255, 0.96);
  --panel-border: rgba(124, 124, 124, 0.33);
  --text-main: #222222;
  --text-dim: #5f5f5f;
  --accent: #6a6a6a;
  --surface-2: rgba(255, 255, 255, 0.92);
  --surface-3: rgba(248, 248, 248, 0.94);
  --row-hover: rgba(77, 77, 77, 0.1);
  --topbar-bg: rgba(250, 250, 250, 0.96);
}

html[data-style="4"][data-theme="steel"] {
  --bg-0: #e9f3fb;
  --bg-1: #dcecf8;
  --bg-2: #d1e6f5;
  --panel: rgba(255, 255, 255, 0.95);
  --panel-border: rgba(96, 139, 171, 0.36);
  --text-main: #1f3446;
  --text-dim: #4a6a81;
  --accent: #2f84c2;
  --surface-2: rgba(244, 250, 255, 0.94);
  --surface-3: rgba(234, 245, 252, 0.95);
  --row-hover: rgba(47, 132, 194, 0.12);
  --topbar-bg: rgba(241, 249, 255, 0.97);
}

html[data-style="4"][data-theme="night"] {
  --bg-0: #1a2027;
  --bg-1: #222a33;
  --bg-2: #2a3440;
  --panel: rgba(36, 43, 53, 0.96);
  --panel-border: rgba(122, 139, 157, 0.35);
  --text-main: #ecf2f8;
  --text-dim: #b8c5d3;
  --accent: #7db3e2;
  --surface-2: rgba(41, 49, 60, 0.92);
  --surface-3: rgba(35, 42, 51, 0.94);
  --row-hover: rgba(125, 179, 226, 0.16);
  --topbar-bg: rgba(30, 38, 47, 0.96);
}

html[data-style="4"][data-theme="night"] .panel-toolbar input,
html[data-style="4"][data-theme="night"] #settings-language-select,
html[data-style="4"][data-theme="night"] #theme-select,
html[data-style="4"][data-theme="night"] .editor-form input,
html[data-style="4"][data-theme="night"] .editor-form select,
html[data-style="4"][data-theme="night"] #language-select,
html[data-style="4"][data-theme="night"] #pwd-current,
html[data-style="4"][data-theme="night"] #pwd-new,
html[data-style="4"][data-theme="night"] #pwd-confirm {
  background: #2a3440;
  color: #ecf2f8;
  border-color: rgba(122, 139, 157, 0.55);
}

html[data-style="6"] {
  --font-main: "Exo 2", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", Consolas, monospace;
  --bg-0: #0e1116;
  --bg-1: #121a22;
  --bg-2: #101820;
  --panel: rgba(14, 20, 27, 0.88);
  --panel-border: rgba(126, 185, 235, 0.5);
  --text-main: #e5f0f8;
  --text-dim: #9eb8cd;
  --accent: #54b6ff;
  --surface-2: rgba(11, 18, 25, 0.82);
  --surface-3: rgba(9, 15, 22, 0.76);
  --row-hover: rgba(84, 182, 255, 0.14);
  --topbar-bg: rgba(8, 14, 20, 0.95);
  --radius: 20px;
  --shadow: 0 20px 40px rgba(2, 6, 10, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-main);
  color: var(--text-main);
  background:
    radial-gradient(circle at 82% 10%, #17406b 0%, transparent 44%),
    radial-gradient(circle at 10% 92%, #15334f 0%, transparent 40%),
    linear-gradient(160deg, var(--bg-0), var(--bg-1) 45%, var(--bg-2));
  overflow-x: hidden;
}

.ambient-lines {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(90deg, rgba(151, 187, 218, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(151, 187, 218, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 40%, black, transparent 80%);
  pointer-events: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 14;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) minmax(220px, 1fr);
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--panel-border);
  background: var(--topbar-bg);
  backdrop-filter: blur(9px);
}

html[data-style="2"] .topbar {
  gap: 0.4rem;
  padding: 0.45rem 0.6rem;
  border-bottom-width: 2px;
}

html[data-style="2"] .panel {
  padding: 0.72rem;
}

html[data-style="2"] .main-table th,
html[data-style="2"] .main-table td {
  padding: 0.44rem 0.45rem;
  border-bottom-style: dashed;
  font-size: 0.86rem;
}

html[data-style="2"] .main-table th {
  font-size: 0.72rem;
}

html[data-style="2"] .bookmark-tab,
html[data-style="2"] .ghost-btn,
html[data-style="2"] .top-chip {
  border-radius: 4px;
}

.brand-link {
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 0;
  cursor: pointer;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-copy {
  display: grid;
}

.brand-logo {
  width: auto;
  height: clamp(2rem, 2.2vw, 2.45rem);
  max-width: min(7rem, 28vw);
  object-fit: contain;
  flex: 0 0 auto;
  border-radius: 0;
  box-shadow: none;
}

.eyebrow {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.5rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-link h1 {
  margin: 0.2rem 0 0;
  line-height: 1;
  letter-spacing: 0.08em;
  font-size: clamp(1.5rem, 2.3vw, 2.1rem);
}

.top-chip,
.module-btn,
.bookmark-tab,
.ghost-btn,
.menu-close {
  font: inherit;
  color: var(--text-main);
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: var(--btn-bg);
}

.top-chip {
  width: 100%;
  text-align: center;
  padding: 0.55rem 0.7rem;
}

.top-chip strong {
  display: block;
  font-size: 0.92rem;
}

.user-chip strong {
  font-size: 0.82rem;
  font-weight: 600;
}

.top-module-title {
  justify-self: center;
  text-align: center;
}

.top-module-title strong {
  font-size: 0.98rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.user-settings-box {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  gap: 0.4rem;
}

.user-chip {
  border: 0;
  background: transparent;
  padding: 0;
}

.settings-icon-btn {
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--btn-bg);
  color: var(--text-main);
  font: 600 1rem/1 var(--font-main);
  cursor: pointer;
}

.settings-icon-btn:hover {
  border-color: var(--accent);
}

.module-switcher {
  position: relative;
}

.module-chip strong {
  text-transform: uppercase;
}

.module-switch-menu {
  position: absolute;
  top: calc(100% + 0.42rem);
  right: 0;
  min-width: 260px;
  z-index: 18;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: var(--shadow);
  padding: 0.5rem;
  display: grid;
  gap: 0.35rem;
}

.module-btn {
  text-align: left;
  padding: 0.5rem 0.66rem;
  cursor: pointer;
}

.module-btn.active {
  border-color: rgba(44, 165, 141, 0.82);
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

.main-content {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.auth-panel {
  max-width: 460px;
  margin: 2.5rem auto;
}

.auth-form {
  max-width: none;
}

.auth-error {
  min-height: 1.2rem;
  color: #c54444;
}

body.auth-only .main-content {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

body.auth-only .auth-panel {
  margin: 0;
  width: min(460px, 100%);
}

.auth-actions {
  display: flex;
  gap: 0.5rem;
}

.public-only {
  display: none;
}

body.public-mode {
  background:
    radial-gradient(circle at top left, rgba(38, 143, 255, 0.14), transparent 34%),
    radial-gradient(circle at top right, rgba(28, 195, 154, 0.18), transparent 30%),
    linear-gradient(180deg, #f5fbff 0%, #edf4f8 42%, #e6eef3 100%);
}

body.public-mode .topbar {
  position: sticky;
  top: 0;
  z-index: 22;
  grid-template-columns: minmax(200px, 0.9fr) minmax(340px, 1.5fr) auto;
  gap: 1.2rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(12, 34, 58, 0.08);
  background: rgba(245, 251, 255, 0.78);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 34px rgba(17, 37, 63, 0.06);
}

body.public-mode .public-only {
  display: flex;
}

body.public-mode .private-only {
  display: none !important;
}

body.public-mode .brand-link h1 {
  font-family: "Space Grotesk", var(--font-main);
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  letter-spacing: 0.02em;
}

body.public-mode .eyebrow {
  font-size: 0.64rem;
  letter-spacing: 0.18em;
}

body.public-mode .brand-logo {
  display: block;
  height: clamp(2.85rem, 3.4vw, 3.65rem);
  max-width: min(10rem, 38vw);
}

body.public-mode .top-module-title {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
}

body.public-mode .top-module-title strong {
  max-width: 640px;
  color: #193247;
  font-family: "Space Grotesk", var(--font-main);
  font-size: 0.92rem;
  line-height: 1.4;
  letter-spacing: 0.03em;
  text-transform: none;
}

.landing-top-nav {
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
}

.landing-top-link,
.landing-header-btn,
.landing-primary-btn,
.landing-secondary-btn {
  font: inherit;
  cursor: pointer;
}

.landing-top-link {
  border: 0;
  background: transparent;
  color: #34526a;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.landing-top-link:hover {
  background: rgba(25, 86, 149, 0.08);
  color: #12355a;
}

.public-header-actions {
  justify-self: end;
  align-items: center;
}

.landing-header-btn {
  border: 1px solid rgba(12, 58, 102, 0.12);
  background: linear-gradient(135deg, #153d61, #0f7d78);
  color: #fff;
  padding: 0.72rem 1.25rem;
  border-radius: 999px;
  font-weight: 700;
  box-shadow: 0 14px 28px rgba(13, 48, 79, 0.16);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.landing-header-btn:hover:not(:disabled),
.landing-primary-btn:hover,
.landing-secondary-btn:hover {
  transform: translateY(-1px);
}

.landing-header-btn:disabled {
  opacity: 0.55;
  cursor: default;
  box-shadow: none;
}

body.public-mode .main-content {
  max-width: none;
  margin: 0;
  gap: 0;
  padding: 0 0 4rem;
}

body.public-mode.auth-only .main-content {
  min-height: calc(100vh - 88px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

body.public-mode .auth-panel {
  margin: 0 auto;
  width: min(480px, 100%);
  border-radius: 28px;
  border-color: rgba(17, 57, 94, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(247, 251, 255, 0.92));
  box-shadow: 0 30px 80px rgba(17, 37, 63, 0.12);
  padding: 1.6rem;
}

.landing-page {
  padding: 0 1.4rem 4rem;
}

.landing-shell {
  width: min(1280px, 100%);
  margin: 0 auto;
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.9fr);
  gap: 1.4rem;
  padding: 2rem 0 1rem;
  align-items: stretch;
}

.landing-hero-copy,
.landing-hero-panel,
.landing-section,
.landing-final-cta {
  border: 1px solid rgba(17, 57, 94, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 249, 253, 0.94));
  box-shadow: 0 22px 60px rgba(16, 37, 61, 0.08);
}

.landing-hero-copy {
  position: relative;
  overflow: hidden;
  border-radius: 32px;
  padding: clamp(1.6rem, 3vw, 3rem);
}

.landing-hero-copy::before {
  content: "";
  position: absolute;
  inset: auto -120px -120px auto;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(29, 143, 255, 0.2), transparent 70%);
  pointer-events: none;
}

.landing-kicker,
.landing-section-kicker,
.landing-panel-label,
.landing-module-code,
.landing-flow-step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  border-radius: 999px;
  background: rgba(19, 91, 155, 0.08);
  color: #14466f;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.landing-kicker {
  padding: 0.45rem 0.8rem;
  margin-bottom: 1rem;
}

.landing-hero h2,
.landing-section-heading h3,
.landing-final-cta h3 {
  margin: 0;
  color: #12283d;
  font-family: "Space Grotesk", var(--font-main);
  line-height: 1.05;
}

.landing-hero h2 {
  max-width: 11ch;
  font-size: clamp(1.55rem, 3.6vw, 2.7rem);
  line-height: 1.15;
}

.landing-lead,
.landing-proof-card p,
.landing-signal-card strong,
.landing-panel-note,
.landing-value-card p,
.landing-module-card p,
.landing-flow-step p,
.landing-team-card p,
.landing-final-cta p {
  color: #466177;
  line-height: 1.68;
}

.landing-lead {
  max-width: 60ch;
  margin: 1.2rem 0 0;
  font-size: 1.05rem;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin: 1.7rem 0 2rem;
}

.landing-primary-btn,
.landing-secondary-btn {
  min-height: 3.25rem;
  padding: 0.82rem 1.3rem;
  border-radius: 999px;
  font-weight: 700;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.landing-primary-btn {
  border: 1px solid transparent;
  background: linear-gradient(135deg, #0f3f68, #0b8a81);
  color: #fff;
  box-shadow: 0 16px 34px rgba(14, 61, 96, 0.18);
}

.landing-secondary-btn {
  border: 1px solid rgba(14, 61, 96, 0.12);
  background: rgba(255, 255, 255, 0.75);
  color: #163c5c;
}

.landing-proof-grid,
.landing-value-grid,
.landing-modules-grid,
.landing-team-grid,
.landing-interface-grid {
  display: grid;
  gap: 1rem;
}

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

.landing-proof-card,
.landing-value-card,
.landing-module-card,
.landing-team-card,
.landing-signal-card,
.landing-flow-step {
  border-radius: 24px;
  border: 1px solid rgba(17, 57, 94, 0.08);
  background: rgba(255, 255, 255, 0.82);
  padding: 1.1rem;
}

.landing-proof-card strong,
.landing-value-card strong,
.landing-module-card strong,
.landing-team-card strong,
.landing-flow-step strong {
  display: block;
  color: #16314a;
  font-size: 1.02rem;
  margin-bottom: 0.45rem;
}

.landing-hero-panel {
  border-radius: 30px;
  padding: 1.4rem;
  display: grid;
  gap: 1rem;
  align-content: start;
  background:
    linear-gradient(180deg, rgba(17, 46, 74, 0.96), rgba(10, 26, 43, 0.98));
  box-shadow: 0 28px 70px rgba(8, 24, 40, 0.24);
}

.landing-panel-head strong,
.landing-signal-card strong,
.landing-panel-note {
  color: rgba(244, 250, 255, 0.92);
}

.landing-panel-label {
  padding: 0.38rem 0.7rem;
  margin-bottom: 0.75rem;
  background: rgba(84, 182, 255, 0.12);
  color: #a7d8ff;
}

.landing-panel-head strong {
  display: block;
  font-family: "Space Grotesk", var(--font-main);
  font-size: 1.6rem;
  line-height: 1.2;
}

.landing-signal-grid {
  display: grid;
  gap: 0.8rem;
}

.landing-signal-card {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(167, 216, 255, 0.1);
}

.landing-signal-card span {
  display: block;
  color: #8ccdfb;
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.landing-panel-note {
  border-top: 1px solid rgba(167, 216, 255, 0.14);
  padding-top: 1rem;
  font-size: 0.95rem;
}

.landing-section {
  border-radius: 28px;
  padding: 1.45rem;
  margin-top: 1.2rem;
}

.landing-section-heading {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 1.1rem;
}

.landing-section-kicker {
  padding: 0.35rem 0.72rem;
}

.landing-section-heading h3,
.landing-final-cta h3 {
  font-size: clamp(1.8rem, 4vw, 2.9rem);
}

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

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

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

.landing-team-card {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  align-items: stretch;
  gap: 1rem;
  overflow: hidden;
  padding: 0.85rem;
}

.landing-team-photo {
  width: 100%;
  height: 100%;
  min-height: 260px;
  object-fit: cover;
  border-radius: 18px;
  background: #eef4f8;
}

.landing-team-body {
  display: grid;
  align-content: center;
  gap: 0.4rem;
  padding-right: 0.2rem;
}

.landing-interface-grid {
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.4fr);
  align-items: start;
}

.landing-interface-copy {
  display: grid;
  gap: 0.85rem;
}

.landing-interface-copy p {
  margin: 0;
  color: #466177;
  line-height: 1.75;
}

.landing-interface-figure {
  margin: 0;
  border-radius: 24px;
  border: 1px solid rgba(17, 57, 94, 0.08);
  background: rgba(255, 255, 255, 0.82);
  padding: 0.8rem;
  box-shadow: 0 20px 48px rgba(16, 37, 61, 0.08);
}

.landing-interface-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
}

.landing-module-card {
  min-height: 200px;
}

.landing-module-code {
  padding: 0.34rem 0.68rem;
  margin-bottom: 0.8rem;
}

.landing-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.landing-flow-step span {
  min-width: 3.2rem;
  padding: 0.36rem 0.68rem;
  margin-bottom: 0.8rem;
}

.landing-final-cta {
  margin-top: 1.2rem;
  border-radius: 32px;
  padding: clamp(1.4rem, 3vw, 2.1rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.landing-footer {
  margin-top: 1rem;
  padding: 1.1rem 0 0.3rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid rgba(17, 57, 94, 0.1);
  color: #49657b;
}

.landing-footer-block strong {
  display: block;
  margin-bottom: 0.35rem;
  color: #173651;
  font-family: "Space Grotesk", var(--font-main);
}

.landing-footer-block p,
.landing-footer-meta span {
  margin: 0;
  line-height: 1.6;
}

.landing-footer a {
  color: #173651;
  text-decoration: none;
}

.landing-footer a:hover {
  text-decoration: underline;
}

.landing-footer-meta {
  display: grid;
  justify-items: end;
  gap: 0.15rem;
  text-align: right;
}

@media (max-width: 1120px) {
  body.public-mode .topbar {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  body.public-mode .top-module-title {
    justify-items: start;
  }

  .landing-hero,
  .landing-proof-grid,
  .landing-value-grid,
  .landing-modules-grid,
  .landing-team-grid,
  .landing-interface-grid,
  .landing-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .landing-final-cta {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 760px) {
  .landing-page {
    padding: 0 0.9rem 2.5rem;
  }

  body.public-mode .topbar {
    padding: 0.9rem 1rem;
  }

  .landing-top-nav {
    gap: 0.2rem;
  }

  .landing-top-link {
    padding-inline: 0.45rem;
  }

  .landing-hero,
  .landing-proof-grid,
  .landing-value-grid,
  .landing-modules-grid,
  .landing-team-grid,
  .landing-interface-grid,
  .landing-flow {
    grid-template-columns: 1fr;
  }

  .landing-team-card {
    grid-template-columns: 1fr;
  }

  .landing-team-photo {
    min-height: 320px;
  }

  .landing-hero-copy,
  .landing-hero-panel,
  .landing-section,
  .landing-final-cta {
    border-radius: 24px;
  }

  .landing-hero h2 {
    max-width: none;
    font-size: clamp(2.2rem, 12vw, 3.3rem);
  }

  .landing-actions {
    flex-direction: column;
  }

  .landing-primary-btn,
  .landing-secondary-btn,
  .landing-header-btn {
    width: 100%;
    justify-content: center;
  }

  .brand-logo {
    height: 1.85rem;
    max-width: min(5.5rem, 34vw);
  }

  body.public-mode .brand-logo {
    height: 2.35rem;
    max-width: min(7rem, 44vw);
  }

  .public-header-actions {
    width: 100%;
  }

  body.public-mode.auth-only .main-content {
    padding: 1rem;
  }

  .landing-footer {
    flex-direction: column;
  }

  .landing-footer-meta {
    justify-items: start;
    text-align: left;
  }
}

.password-field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.35rem;
}

.password-toggle {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--surface-1);
  color: var(--text-main);
  min-width: 2rem;
  height: 2rem;
  cursor: pointer;
  line-height: 1;
}

html[data-style="4"] body {
  background:
    repeating-linear-gradient(
      0deg,
      color-mix(in srgb, var(--bg-1) 88%, #ffffff 12%) 0 34px,
      color-mix(in srgb, var(--bg-2) 76%, #ffffff 24%) 34px 35px
    ),
    linear-gradient(180deg, var(--bg-0), var(--bg-1) 58%, var(--bg-2));
}

html[data-style="4"] .ambient-lines {
  display: none;
}

html[data-style="4"] .topbar {
  position: static;
  grid-template-columns: 1fr 1fr 1fr;
  border-bottom: 2px solid var(--panel-border);
  box-shadow: 0 2px 0 rgba(113, 104, 87, 0.2);
}

html[data-style="4"] .brand-link h1 {
  letter-spacing: 0.02em;
  font-size: 1.5rem;
}

html[data-style="4"] .main-content {
  max-width: 1320px;
  margin: 0 auto;
}

html[data-style="4"] body.public-mode {
  background:
    radial-gradient(circle at top left, rgba(38, 143, 255, 0.14), transparent 34%),
    radial-gradient(circle at top right, rgba(28, 195, 154, 0.18), transparent 30%),
    linear-gradient(180deg, #f5fbff 0%, #edf4f8 42%, #e6eef3 100%);
}

html[data-style="4"] body.public-mode .topbar {
  position: sticky;
  grid-template-columns: minmax(200px, 0.9fr) minmax(340px, 1.5fr) auto;
  border-bottom: 1px solid rgba(12, 34, 58, 0.08);
  box-shadow: 0 12px 34px rgba(17, 37, 63, 0.06);
}

html[data-style="4"] body.public-mode .brand-link h1 {
  font-size: clamp(1.45rem, 2.2vw, 2rem);
}

html[data-style="4"] body.public-mode .main-content {
  max-width: none;
  margin: 0;
}

html[data-style="4"] body.public-mode .auth-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(247, 251, 255, 0.92));
  box-shadow: 0 30px 80px rgba(17, 37, 63, 0.12);
}

html[data-style="4"] .panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: none;
}

html[data-style="4"] .bookmarks {
  border-bottom: 2px solid var(--panel-border);
}

html[data-style="4"] .bookmark-tab,
html[data-style="4"] .ghost-btn,
html[data-style="4"] .top-chip,
html[data-style="4"] .module-btn {
  border-radius: 2px;
  box-shadow: none;
}

html[data-style="4"] .main-table th,
html[data-style="4"] .main-table td {
  white-space: normal;
  border-bottom: 1px solid var(--panel-border);
}

html[data-style="4"] .main-table th {
  color: var(--text-dim);
  font-weight: 700;
}

.panel {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  padding: 1rem;
}

html[data-style="6"] .topbar {
  border-bottom: 1.5px solid color-mix(in srgb, var(--accent) 50%, var(--panel-border));
  box-shadow: 0 0 0 1px rgba(84, 182, 255, 0.12) inset;
}

html[data-style="6"] .brand-link h1 {
  letter-spacing: 0.12em;
  text-shadow: 0 0 16px rgba(84, 182, 255, 0.22);
}

html[data-style="6"] .panel {
  background:
    linear-gradient(155deg, rgba(17, 28, 40, 0.9), rgba(11, 18, 25, 0.92));
  box-shadow:
    0 0 0 1px rgba(84, 182, 255, 0.18) inset,
    0 20px 40px rgba(2, 6, 10, 0.45);
}

html[data-style="6"] .bookmark-tab,
html[data-style="6"] .ghost-btn,
html[data-style="6"] .top-chip,
html[data-style="6"] .module-btn {
  border-radius: 14px 5px 14px 5px;
}

html[data-style="6"] .style-btn.active,
html[data-style="6"] .bookmark-tab.active,
html[data-style="6"] .module-btn.active {
  box-shadow: 0 0 18px rgba(84, 182, 255, 0.22);
}

html[data-style="6"] .main-table {
  border-collapse: separate;
  border-spacing: 0;
}

html[data-style="6"] .main-table th {
  font-family: var(--font-mono);
}

html[data-style="6"] .main-table td {
  border-bottom-width: 1.5px;
}

.module-hidden {
  display: none !important;
}

.bookmarks {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--panel-border);
}

.bookmark-tab {
  padding: 0.5rem 0.72rem;
  cursor: pointer;
}

.bookmark-tab.active {
  border-color: rgba(44, 165, 141, 0.82);
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

.tab-panel {
  display: grid;
  gap: 0.7rem;
}

.tab-panel.module-hidden {
  display: none;
}

#page-tch.tch-editor-open #tch-bookmarks {
  display: none !important;
}

#page-tch.tch-editor-open #tch-product-types-toolbar,
#page-tch.tch-editor-open #tch-product-types-list,
#page-tch.tch-editor-open #tch-product-types-footer {
  display: none !important;
}

#page-tch.tch-editor-open.tch-readonly-editor #tch-approval-editor-row,
#page-tch.tch-editor-open.tch-readonly-editor #tch-editor-photo-actions,
#page-tch.tch-editor-open.tch-readonly-editor #tch-editor-photo-open,
#page-tch.tch-editor-open.tch-readonly-editor #tch-editor-photo-camera,
#page-tch.tch-editor-open.tch-readonly-editor #tch-editor-camera-actions {
  display: none !important;
}

#page-tch.tch-readonly-editor .tch-rich-toolbar {
  display: none !important;
}

.employees-toolbar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.employees-toolbar #employees-search {
  max-width: 560px;
}

.mpers-toolbar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.mpers-toolbar > input {
  flex: 1 1 320px;
  max-width: 620px;
}

.mpers-toolbar-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.dismissed-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-main);
  white-space: nowrap;
}

#employees-dismissed-period {
  font: inherit;
  color: var(--text-main);
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: var(--surface-2);
  padding: 0.62rem 0.72rem;
  min-width: 210px;
}

.panel-toolbar input,
.panel-toolbar select,
#settings-language-select,
#theme-select,
.settings-card input,
.settings-card select,
.settings-card textarea,
.editor-form input,
.editor-form select,
#language-select,
#pwd-current,
#pwd-new,
#pwd-confirm {
  width: 100%;
  font: inherit;
  color: var(--text-main);
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(9, 22, 35, 0.74);
  background: var(--surface-2);
  padding: 0.62rem 0.72rem;
}

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

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

.main-table th,
.main-table td {
  text-align: left;
  padding: 0.62rem 0.55rem;
  border-bottom: 1px solid var(--panel-border);
  font-size: 0.92rem;
  white-space: nowrap;
}

.main-table th {
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.narrow-cell {
  width: 2.2rem;
  text-align: center !important;
}

.tch-sub-row td {
  color: var(--text-dim);
  font-size: 0.86rem;
}

.tch-expand-btn {
  min-width: 1.8rem;
  min-height: 1.8rem;
  padding: 0;
}

.sort-btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  padding: 0;
}

.sort-indicator {
  color: var(--text-dim);
  font-size: 0.76rem;
}

.sort-btn.active .sort-indicator {
  color: var(--text-main);
}

.main-table td.time-deviation-warn,
.main-table input.time-deviation-warn {
  background: color-mix(in srgb, #dd8b1a 20%, transparent);
  color: inherit;
}

.main-table td.time-deviation-alert,
.main-table input.time-deviation-alert {
  background: color-mix(in srgb, #c54444 22%, transparent);
  color: inherit;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: var(--row-hover);
}

.employee-dismissed td {
  text-decoration: line-through;
  opacity: 0.8;
}

.system-user-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  margin-left: 0.35rem;
  border: 1px solid var(--panel-border);
  border-radius: 50%;
  font-size: 0.72rem;
  line-height: 1;
  color: var(--text-main);
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  vertical-align: middle;
}

.employee-status-cell {
  text-align: center;
  width: 70px;
}

.employee-status-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  color: #fff;
  font: 700 0.72rem/1 var(--font-main);
}

.employee-status-dot.green {
  background: #1c9e49;
}

.employee-status-dot.red {
  background: #c54444;
}

.employee-status-dot.neutral {
  background: #8a98a5;
}

.panel-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
}

.panel-footer-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.plres-account-row td {
  color: var(--text-dim);
}

#page-plres .panel-toolbar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

#page-tch .panel-toolbar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

#page-mmnf .panel-toolbar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

#page-otk .panel-toolbar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

#page-plres,
#page-plres-editor {
  --plres-btn-size: var(--icon-btn-size);
  --plres-btn-inset: var(--icon-btn-inset);
  --plres-icon-ratio: var(--icon-btn-ratio);
  --plres-icon-stroke: var(--icon-btn-stroke);
}

#page-tch {
  --plres-btn-size: var(--icon-btn-size);
  --plres-btn-inset: var(--icon-btn-inset);
  --plres-icon-ratio: var(--icon-btn-ratio);
  --plres-icon-stroke: var(--icon-btn-stroke);
}

#page-plres .panel-toolbar > input {
  flex: 1 1 320px;
  max-width: 520px;
}

#page-tch .panel-toolbar > input {
  flex: 1 1 320px;
  max-width: 620px;
}

#page-mmnf .panel-toolbar > input {
  flex: 1 1 320px;
  max-width: 620px;
}

#page-otk .panel-toolbar > input {
  flex: 1 1 320px;
  max-width: 620px;
}

#page-ncfi .panel-toolbar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

#page-ncfi .panel-toolbar > input {
  flex: 1 1 320px;
  max-width: 620px;
}

#ncfi-tab-nonconformities .panel-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.7rem;
}

#ncfi-tab-nonconformities .plres-toolbar-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: nowrap;
}

#ncfi-tab-nonconformities .panel-toolbar > input {
  flex: 1 1 auto;
  min-width: 0;
}

#ncfi-tab-nonconformities #ncfi-nc-status {
  width: 10.8rem !important;
  min-width: 10.8rem;
}

#ncfi-tab-incidents .panel-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.7rem;
}

#ncfi-tab-incidents .panel-toolbar > input {
  flex: 0 1 27rem;
  min-width: 0;
  max-width: 27rem;
}

#ncfi-tab-incidents .plres-toolbar-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

#ncfi-tab-incidents #ncfi-inc-status,
#ncfi-tab-incidents #ncfi-inc-source {
  width: 12.5rem !important;
  min-width: 12.5rem;
}

#ncfi-tab-incidents #ncfi-inc-search {
  width: 27rem;
  min-width: 27rem;
}

#ncfi-tab-incidents #ncfi-inc-source {
  width: 9.4rem !important;
  min-width: 9.4rem;
}

#ncfi-tab-incidents #ncfi-inc-from,
#ncfi-tab-incidents #ncfi-inc-to {
  width: 8.6rem !important;
  min-width: 8.6rem;
}

#ncfi-tab-actions .panel-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.7rem;
}

#ncfi-tab-actions .panel-toolbar > input {
  flex: 0 1 30rem;
  min-width: 0;
  max-width: 30rem;
}

#ncfi-tab-actions .plres-toolbar-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

#ncfi-tab-actions #ncfi-actions-status {
  width: 11rem !important;
  min-width: 11rem;
}

#ncfi-tab-actions #ncfi-actions-assignee {
  width: 12rem !important;
  min-width: 12rem;
}

#ncfi-tab-actions #ncfi-actions-period {
  width: 9rem !important;
  min-width: 9rem;
}

#page-ncfi.inc-editor-mode > .bookmarks {
  display: none;
}

#ncfi-inc-editor-section {
  margin-top: 0;
  width: 100%;
  max-width: none;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
}

#ncfi-inc-editor-section .editor-head {
  margin-top: 0;
  margin-bottom: 0.7rem;
  padding-top: 0;
  align-items: flex-start;
}

#ncfi-inc-editor-section .editor-head h3 {
  margin: 0;
  line-height: 1.1;
}

#page-ncfi .ncfi-inc-row-1 {
  grid-template-columns:
    minmax(0, 9fr)
    minmax(0, 11fr)
    minmax(0, 22fr)
    minmax(0, 45fr)
    minmax(0, 13fr);
  width: 100%;
}

#page-ncfi .ncfi-inc-row-2 {
  grid-template-columns:
    minmax(0, 10fr)
    minmax(0, 8fr)
    minmax(0, 41fr)
    minmax(0, 41fr);
  width: 100%;
}

#page-ncfi .ncfi-inc-row-3 {
  grid-template-columns:
    minmax(0, 40fr)
    minmax(0, 40fr)
    minmax(0, 8fr)
    minmax(0, 12fr);
  width: 100%;
}

#page-ncfi .ncfi-inc-row-1 > label,
#page-ncfi .ncfi-inc-row-2 > label,
#page-ncfi .ncfi-inc-row-3 > label {
  min-width: 0 !important;
}

#page-ncfi .ncfi-inc-row-1 > label > input,
#page-ncfi .ncfi-inc-row-1 > label > select,
#page-ncfi .ncfi-inc-row-2 > label > input,
#page-ncfi .ncfi-inc-row-2 > label > select,
#page-ncfi .ncfi-inc-row-3 > label > input,
#page-ncfi .ncfi-inc-row-3 > label > select {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
}

#page-ncfi .ncfi-inc-description-media {
  margin-top: 0.45rem;
}

#page-ncfi .ncfi-cause-detail-gap {
  margin-top: 0.52rem;
}

#page-ncfi .ncfi-cause-actions-subblock {
  margin-top: 0.62rem;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-2) 86%, #ffffff 14%);
  padding: 0.55rem 0.65rem 0.45rem;
}

#page-ncfi .ncfi-inline-actions-tight {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
}

#page-ncfi .ncfi-actions-form-gap {
  margin-top: 0.52rem;
}

#page-ncfi .ncfi-action-add-row {
  margin-bottom: 0.5rem;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 18%) minmax(152px, 9%) 42px;
  align-items: end;
  gap: 0.7rem;
}

#page-ncfi .ncfi-action-add-row .ncfi-action-col-title {
  min-width: 0;
}

#page-ncfi .ncfi-action-add-row .ncfi-action-col-assignee,
#page-ncfi .ncfi-action-add-row .ncfi-action-col-due {
  min-width: 0;
}

#page-ncfi .ncfi-action-add-btn-wrap {
  display: flex;
  align-items: end;
  justify-content: center;
  padding-top: 0;
  width: 42px;
  min-width: 42px;
  margin-left: 0.1rem;
  transform: translateY(-11px);
}

#page-ncfi .ncfi-action-inline-input,
#page-ncfi .ncfi-action-inline-select,
#page-ncfi .ncfi-action-inline-date {
  width: 100%;
  min-height: 32px;
}

#page-ncfi .ncfi-action-inline-select {
  min-width: 140px;
}

#page-ncfi .ncfi-action-icon-btn {
  width: 2rem;
  height: 2rem;
  padding: 0.2rem;
  margin-right: 0.22rem;
}

#page-ncfi .ncfi-action-icon-btn:last-child {
  margin-right: 0;
}

#page-ncfi .ncfi-action-icon-btn svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#page-ncfi .ncfi-action-state-badge {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  border: 1px solid var(--panel-border);
}

#page-ncfi .ncfi-action-state-created,
#page-ncfi .ncfi-action-state-assigned {
  background: color-mix(in srgb, var(--surface-2) 82%, #ffffff 18%);
  color: var(--text-main);
}

#page-ncfi .ncfi-action-state-in_progress {
  background: color-mix(in srgb, #f5cf42 38%, #ffffff 62%);
  border-color: color-mix(in srgb, #e5b800 55%, var(--panel-border) 45%);
  color: #5a4300;
}

#page-ncfi .ncfi-action-state-done {
  background: color-mix(in srgb, #2e7d32 24%, #ffffff 76%);
  border-color: color-mix(in srgb, #2e7d32 60%, var(--panel-border) 40%);
  color: #1b5e20;
}

#page-ncfi .ncfi-action-state-cancelled {
  background: color-mix(in srgb, #c62828 22%, #ffffff 78%);
  border-color: color-mix(in srgb, #c62828 58%, var(--panel-border) 42%);
  color: #8e1717;
}

#page-ncfi #ncfi-actions-body tr.active-row td {
  background: color-mix(in srgb, var(--accent) 20%, var(--surface-2) 80%);
}

#page-ncfi .ncfi-action-result-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.45rem;
}

#page-ncfi .ncfi-action-result-row .ncfi-action-result-field {
  min-width: 0;
}

#page-ncfi .ncfi-action-result-row .ncfi-action-result-field textarea {
  width: 100%;
}

#page-ncfi .ncfi-action-result-attach-wrap {
  display: flex;
  justify-content: flex-end;
  align-items: end;
  align-self: end;
  padding-bottom: 0.72rem;
}

#page-ncfi #ncfi-action-result-compose {
  margin-top: 0.1rem;
  min-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}

#page-ncfi #ncfi-action-result-pending:empty {
  display: none;
}

#page-ncfi #ncfi-correction-table {
  table-layout: fixed;
  width: 100%;
}

#page-ncfi #ncfi-correction-table th:nth-child(1),
#page-ncfi #ncfi-correction-table td:nth-child(1) {
  width: 22.5%;
}

#page-ncfi #ncfi-correction-table th:nth-child(2),
#page-ncfi #ncfi-correction-table td:nth-child(2) {
  width: 10%;
}

#page-ncfi #ncfi-correction-table th:nth-child(3),
#page-ncfi #ncfi-correction-table td:nth-child(3) {
  width: auto;
}

#page-ncfi #ncfi-correction-table th:nth-child(4),
#page-ncfi #ncfi-correction-table td:nth-child(4) {
  width: 15%;
}

#page-ncfi #ncfi-correction-table th:nth-child(5),
#page-ncfi #ncfi-correction-table td:nth-child(5) {
  width: 52px;
}

#page-ncfi #ncfi-correction-table.ncfi-correction-qr th:nth-child(2),
#page-ncfi #ncfi-correction-table.ncfi-correction-qr td:nth-child(2) {
  display: none;
}

#page-ncfi #ncfi-correction-lines-body input,
#page-ncfi #ncfi-correction-lines-body select {
  width: 100%;
}

@media (max-width: 1080px) {
  #page-ncfi .ncfi-action-add-row {
    grid-template-columns: minmax(0, 1fr);
  }
  #page-ncfi .ncfi-action-add-btn-wrap {
    justify-content: flex-start;
    padding-top: 0;
  }
}

#page-ncfi .ncfi-inc-manual-media {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  margin-top: 0.2rem;
}

#page-ncfi .ncfi-inc-manual-media.ncfi-inc-manual-with-camera {
  grid-template-columns: minmax(0, 3fr) minmax(300px, 1fr);
}

#page-ncfi #ncfi-inc-description {
  min-height: 4.8rem;
  height: auto;
  resize: none;
  line-height: 1.35;
  border-radius: 10px;
  font-family: var(--font-main);
  overflow-y: auto;
}

#page-ncfi .ncfi-inc-manual-media .mmnf-action-note-pane > label {
  display: block;
}

#page-ncfi .ncfi-inc-manual-media .mmnf-action-note-pane > label > textarea {
  width: 100%;
  box-sizing: border-box;
}

#page-ncfi #ncfi-inc-manual-camera-wrap {
  display: grid;
  gap: 0.42rem;
  align-content: start;
}

#page-ncfi #ncfi-cause-camera-wrap {
  display: grid;
  gap: 0.42rem;
  align-content: start;
}

#page-ncfi #ncfi-inc-manual-video {
  width: 100%;
  min-height: 14rem;
  max-height: 22rem;
  object-fit: cover;
  border: 1px dashed var(--panel-border);
  border-radius: 10px;
  background: var(--surface-2);
}

#page-ncfi #ncfi-cause-video {
  width: 100%;
  min-height: 14rem;
  max-height: 22rem;
  object-fit: cover;
  border: 1px dashed var(--panel-border);
  border-radius: 10px;
  background: var(--surface-2);
}

#page-ncfi #ncfi-inc-manual-camera-wrap .mmnf-action-video-actions .icon-btn {
  background: color-mix(in srgb, var(--surface-2) 78%, #ffffff 22%);
}

#page-ncfi .ncfi-inc-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.5rem;
}

#page-ncfi .ncfi-inc-media-item {
  position: relative;
}

#page-ncfi .ncfi-inc-media-grid a {
  display: block;
  text-decoration: none;
}

#page-ncfi .ncfi-inc-media-grid img {
  width: 100%;
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--surface-1);
}

#page-ncfi .ncfi-inc-file-list {
  margin-top: 0.45rem;
  display: grid;
  gap: 0.25rem;
}

#page-ncfi .ncfi-inc-file-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

#page-ncfi .ncfi-inc-file-list a {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#page-ncfi .ncfi-inc-attachment-links {
  margin-top: 0.2rem;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
}

#page-ncfi .ncfi-inc-attachment-links a {
  text-decoration: underline;
}

#page-ncfi .ncfi-inc-attach-remove {
  width: 1.55rem;
  height: 1.55rem;
  min-width: 1.55rem;
  min-height: 1.55rem;
  padding: 0;
  line-height: 1;
  font-weight: 700;
}

#page-ncfi .ncfi-inc-media-item > .ncfi-inc-attach-remove {
  position: absolute;
  top: 0.22rem;
  right: 0.22rem;
  background: color-mix(in srgb, var(--danger, #b3261e) 20%, #ffffff 80%);
}

#page-ncfi .ncfi-inc-no-cell input {
  width: 100%;
}

#page-ncfi .ncfi-nc-meta-row {
  grid-template-columns: minmax(5.2rem, 1fr) minmax(16rem, 8.4fr) minmax(14rem, 3.75fr) minmax(8.2rem, 1.9fr);
}

#page-ncfi .ncfi-nc-no-cell input {
  width: 100%;
}

#ncfi-nc-chat-box .discussion-head {
  margin-bottom: 0.35rem;
}

#ncfi-nc-chat-box .discussion-head h3 {
  margin: 0;
  flex: 1 1 auto;
}

@media (max-width: 1280px) {
  #page-ncfi .ncfi-inc-row-1,
  #page-ncfi .ncfi-inc-row-2,
  #page-ncfi .ncfi-inc-row-3 {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  #page-ncfi .ncfi-inc-manual-media,
  #page-ncfi .ncfi-inc-manual-media.ncfi-inc-manual-with-camera {
    grid-template-columns: minmax(0, 1fr);
  }

  #page-ncfi .ncfi-nc-meta-row {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

#otk-tab-orders .plres-toolbar-actions {
  margin-left: auto;
}

#otk-tab-orders #otk-month {
  width: 9.1rem !important;
  min-width: 9.1rem;
}

#otk-tab-timesheet .plres-toolbar-actions {
  margin-left: auto;
}

#otk-tab-timesheet #otk-timesheet-month,
#otk-tab-timesheet #otk-timesheet-view {
  width: 9.1rem !important;
  min-width: 9.1rem;
}

#mmnf-tab-qr .plres-toolbar-actions,
#otk-tab-qr .plres-toolbar-actions {
  margin-left: auto;
}

#mmnf-tab-qr .qr-date-input,
#otk-tab-qr .qr-date-input {
  width: 9.1rem !important;
  min-width: 9.1rem;
}

.mmnf-qr-scan-pane {
  position: absolute;
  top: 0;
  right: 0;
  left: auto;
  width: 260px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 0.45rem;
  background: var(--surface-2);
  z-index: 40;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.qr-scan-popover-wrap {
  position: relative;
  display: inline-flex;
  align-items: flex-start;
  align-self: stretch;
}

.qr-scan-popover-wrap.qr-open > .icon-btn {
  visibility: hidden;
  pointer-events: none;
}

.mmnf-qr-scan-video-wrap {
  position: relative;
}

.mmnf-qr-scan-pane video {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px dashed var(--panel-border);
  background: #000;
}

.mmnf-qr-scan-actions {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  display: flex;
  gap: 0.35rem;
  z-index: 2;
}

.mmnf-qr-scan-pane .hint {
  margin-top: 0.32rem;
  font-size: 0.78rem;
}

.qr-link-btn {
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 0.14rem;
}

.qr-hint-cell {
  position: relative;
}

.qr-hint-cell:hover {
  background: var(--row-hover);
}

.qr-hint-cell[data-hint]:hover::after {
  content: attr(data-hint);
  position: absolute;
  left: 0.3rem;
  top: calc(100% - 0.1rem);
  z-index: 16;
  max-width: 360px;
  white-space: normal;
  color: var(--text-main);
  background: var(--surface-2);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 0.32rem 0.45rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
}

.plres-toolbar-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.tch-toolbar-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.plres-inline-input {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.plres-inline-input input {
  height: calc(var(--plres-btn-size) + (var(--plres-btn-inset) * 2));
  padding-right: calc(var(--plres-btn-size) + var(--plres-btn-inset) + 0.5rem) !important;
}

.plres-status-input {
  width: 18.2rem !important;
  min-width: 18.2rem;
}

.plres-code-input {
  width: 13.5ch !important;
  min-width: 13.5ch;
  text-transform: uppercase;
}

.plres-inline-icon {
  position: absolute;
  right: var(--plres-btn-inset);
  top: var(--plres-btn-inset);
  width: var(--plres-btn-size);
  height: var(--plres-btn-size);
  min-width: var(--plres-btn-size);
  padding: 0;
  overflow: hidden;
}

.plres-circle-icon {
  border-radius: 50%;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.plres-circle-icon svg {
  width: calc(var(--plres-btn-size, var(--icon-btn-size)) * var(--plres-icon-ratio, var(--icon-btn-ratio)));
  height: calc(var(--plres-btn-size, var(--icon-btn-size)) * var(--plres-icon-ratio, var(--icon-btn-ratio)));
  stroke-width: var(--plres-icon-stroke, var(--icon-btn-stroke));
  stroke-linecap: round;
  stroke-linejoin: round;
}

.plres-source-indicators {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.plres-source-indicator {
  width: 1.55rem;
  height: 1.55rem;
  min-width: 1.55rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font: 700 0.78rem/1 var(--font-main);
}

.plres-source-indicator.up {
  background: #1c9e49;
}

.plres-source-indicator.down {
  background: #c54444;
}

.plres-status-input:disabled {
  color: var(--text-dim);
  opacity: 1;
}

@media (max-width: 980px) {
  #page-plres .panel-toolbar > input {
    flex-basis: 100%;
    max-width: none;
  }

  #page-tch .panel-toolbar > input {
    flex-basis: 100%;
    max-width: none;
  }

  #page-mmnf .panel-toolbar > input {
    flex-basis: 100%;
    max-width: none;
  }

  #page-otk .panel-toolbar > input {
    flex-basis: 100%;
    max-width: none;
  }

  .plres-toolbar-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .tch-toolbar-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
}

.ghost-btn,
.menu-close {
  padding: 0.5rem 0.72rem;
  cursor: pointer;
}

.status-codes-box {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 0.6rem 0.72rem;
  background: var(--surface-3);
}

.status-codes-box p {
  margin: 0;
}

.status-codes-box p:first-child {
  color: var(--text-dim);
  font-size: 0.84rem;
  margin-bottom: 0.24rem;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 0.8rem;
}

.module-card {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: var(--surface-3);
  padding: 0.7rem;
  cursor: pointer;
}

.module-card h3,
.module-card p {
  margin: 0;
}

.module-card p {
  margin-top: 0.3rem;
  color: var(--text-dim);
}

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

.settings-card {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: var(--surface-3);
  padding: 0.75rem;
}

.settings-card h3 {
  margin: 0 0 0.6rem;
}

.settings-card-wide {
  grid-column: 1 / -1;
}

.settings-ai-decoy {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.settings-card label,
.editor-form label {
  display: grid;
  gap: 0.26rem;
  margin-bottom: 0.48rem;
}

.settings-card span,
.editor-form span {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.settings-card input[readonly] {
  opacity: 0.88;
}

.hint {
  margin: 0.4rem 0 0;
  color: var(--text-dim);
  font-size: 0.84rem;
}

.inline-hint {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
}

.inline-link-btn {
  background: transparent;
  border: none;
  color: var(--accent-strong);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
}

.inline-link-btn:hover {
  color: var(--text);
}

.settings-footer {
  margin-top: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.settings-footer-right {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

#page-user-settings .settings-action-btn,
#page-ai-analysis .settings-action-btn,
#page-ai-settings .settings-action-btn {
  min-height: var(--icon-btn-size);
  padding: 0.5rem 0.82rem;
  background: var(--btn-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  font-weight: 600;
}

#page-user-settings .settings-action-btn:hover,
#page-ai-analysis .settings-action-btn:hover,
#page-ai-settings .settings-action-btn:hover {
  background: var(--btn-hover);
}

#page-ai-analysis,
#page-ai-settings {
  display: grid;
  gap: 0.9rem;
}

.ai-analysis-page-hint {
  margin: 0.35rem 0 0;
  max-width: none;
}

.ai-analysis-card {
  width: 100%;
  max-width: none;
}

.ai-analysis-head-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.ai-analysis-workspace-card {
  display: grid;
  gap: 1rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.settings-ai-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.85rem;
}

.settings-ai-card-head h3 {
  margin: 0;
}

#settings-ai-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 0.75rem;
  align-items: start;
}

#settings-ai-form label {
  margin-bottom: 0;
}

#settings-ai-form > .hint {
  grid-column: 1 / -1;
}

#settings-ai-form > label:first-child {
  grid-column: 1 / -1;
}

.settings-ai-chat-box,
.settings-ai-search-box,
#ai-image-ops-card {
  width: 100%;
}

.settings-ai-chat-messages {
  min-height: 14rem;
}

.ai-chat-examples {
  display: grid;
  gap: 0.7rem;
  margin: 0.25rem 0 0.2rem;
  padding: 0.75rem;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, var(--surface-2)), var(--surface-2));
}

.ai-chat-examples-head {
  display: grid;
  gap: 0.22rem;
}

.ai-chat-examples-head h4 {
  margin: 0;
}

.ai-chat-example-grid {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.ai-chat-example-btn {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 0.28rem;
  padding: 0.8rem 0.85rem;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--surface-1);
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.ai-chat-example-btn:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-1));
  transform: translateY(-1px);
}

.ai-chat-example-title {
  font-weight: 700;
}

.ai-chat-example-prompt {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

.settings-ai-chat-message {
  max-width: min(92%, 56rem);
}

.settings-ai-chat-user {
  justify-self: end;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-1));
}

.settings-ai-chat-assistant {
  justify-self: start;
}

#settings-ai-chat-form {
  display: grid;
  gap: 0.65rem;
}

#settings-ai-chat-form label {
  margin-bottom: 0;
}

#settings-ai-chat-form textarea {
  margin: 0;
  min-height: 6rem;
}

.settings-ai-chat-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  align-items: center;
}

.settings-ai-chat-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 12rem));
  gap: 0.55rem;
  margin-top: 0.55rem;
}

.settings-ai-chat-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: var(--surface-2);
}

.settings-ai-search-form {
  margin-top: 1rem;
}

.settings-ai-search-form {
  display: grid;
  gap: 0.65rem;
}

#page-ai-analysis .settings-ai-chat-actions .icon-btn {
  width: var(--plres-btn-size, var(--icon-btn-size));
  height: var(--plres-btn-size, var(--icon-btn-size));
  min-width: var(--plres-btn-size, var(--icon-btn-size));
}

.settings-ai-search-checkbox {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.settings-ai-search-checkbox input[type="checkbox"] {
  width: auto;
  min-width: 1rem;
}

.settings-ai-search-results {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.settings-ai-search-reference-card,
.settings-ai-search-groups-card,
.settings-ai-search-result {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 0.7rem;
}

.settings-ai-search-reference-card {
  display: grid;
  gap: 0.7rem;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, var(--surface-2)), var(--surface-2));
}

.settings-ai-search-groups-card {
  display: grid;
  gap: 0.7rem;
}

.settings-ai-search-groups-grid {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.settings-ai-search-group {
  width: 100%;
  text-align: left;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--surface-1);
  color: inherit;
  padding: 0.75rem;
  display: grid;
  gap: 0.4rem;
  cursor: pointer;
}

.settings-ai-search-group.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-1));
}

.settings-ai-search-group-head {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
}

.settings-ai-search-result-layout {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: minmax(140px, 180px) minmax(0, 1fr);
  align-items: start;
}

.settings-ai-search-result-content {
  min-width: 0;
}

.settings-ai-search-preview-box {
  display: grid;
  gap: 0.45rem;
}

.settings-ai-search-preview-media {
  min-height: 132px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, var(--surface-1)), var(--surface-1));
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-ai-search-preview-image {
  width: 100%;
  height: 100%;
  min-height: 132px;
  max-height: 180px;
  object-fit: cover;
  display: block;
}

.settings-ai-search-preview-empty {
  padding: 0.9rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.settings-ai-search-preview-copy {
  display: grid;
  gap: 0.18rem;
}

.settings-ai-search-preview-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.settings-ai-search-preview-name {
  font-weight: 600;
  word-break: break-word;
}

.settings-ai-search-reasons {
  margin: 0.55rem 0 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.22rem;
}

.settings-ai-search-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.7rem;
}

.ai-image-ops-box {
  margin-top: 0;
  border-top: 0;
  padding-top: 0;
}

.ai-image-ops-sections {
  display: grid;
  gap: 0.75rem;
}

.ai-image-ops-section {
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 0.9rem;
  display: grid;
  gap: 0.85rem;
}

.ai-image-ops-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.ai-image-ops-section-head h4 {
  margin: 0;
}

.ai-image-ops-inline-fields,
.ai-image-ops-summary-grid {
  display: grid;
  gap: 0.75rem;
}

.ai-image-ops-inline-fields {
  margin-top: 1rem;
}

.ai-image-ops-inline-fields label {
  margin-bottom: 0;
}

.ai-image-ops-inline-fields-reconcile {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ai-image-ops-inline-fields-ingest {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ai-image-ops-summary-grid-triple {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ai-image-ops-summary-grid-reconcile {
  grid-template-columns: minmax(0, 15%) minmax(0, 25%) minmax(0, 1fr);
}

.ai-image-ops-summary-grid-double {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}

.ai-image-ops-summary-card {
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 0.85rem;
  display: grid;
  gap: 0.65rem;
}

.ai-image-ops-summary-card h4 {
  margin: 0;
}

.ai-image-ops-metric-list,
.ai-image-ops-log-list {
  display: grid;
  gap: 0.55rem;
}

@media (max-width: 1100px) {
  .ai-image-ops-inline-fields-reconcile,
  .ai-image-ops-inline-fields-ingest,
  .ai-image-ops-summary-grid-triple,
  .ai-image-ops-summary-grid-double {
    grid-template-columns: 1fr;
  }
}

.ai-image-ops-metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: var(--surface-1);
}

.ai-image-ops-metric-label {
  color: var(--text-muted);
}

.ai-image-ops-log-card {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: var(--surface-1);
  padding: 0.7rem;
}

.ai-image-ops-problem-item {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--panel-border);
}

.ai-image-ops-problem-path {
  font-weight: 700;
  color: var(--text-main);
}

#ai-image-ops-recent-reconcile .ai-image-ops-log-card .discussion-message-head {
  align-items: flex-start;
}

#ai-image-ops-recent-reconcile .ai-image-ops-log-card .discussion-message-head strong {
  line-height: 1.35;
}

#ai-image-ops-recent-reconcile .ai-image-ops-log-card .hint {
  white-space: nowrap;
  overflow-x: auto;
}

.ai-source-target-highlight {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 3px;
  border-radius: 12px;
  transition: outline-color 0.25s ease;
}

.settings-ai-search-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.settings-ai-search-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-1));
  color: var(--text-main);
  font-size: 0.74rem;
  white-space: nowrap;
}

.settings-ai-search-badge-warning {
  background: color-mix(in srgb, #d97706 18%, var(--surface-1));
}

.settings-ai-search-badge-ok {
  background: color-mix(in srgb, #15803d 14%, var(--surface-1));
}

@media (max-width: 760px) {
  .settings-ai-search-result-layout {
    grid-template-columns: 1fr;
  }

  .settings-ai-search-preview-image {
    max-height: 220px;
  }

  .settings-ai-search-result-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

#settings-ai-result.ok {
  color: var(--ok);
}

#settings-ai-result.error {
  color: var(--danger);
}

#page-user-settings .auth-actions .icon-btn {
  width: var(--icon-btn-size);
  height: var(--icon-btn-size);
  min-width: var(--icon-btn-size);
}

.audit-toolbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.audit-toolbar #audit-search {
  max-width: 560px;
}

#audit-body code {
  display: block;
  max-width: 360px;
  white-space: pre-wrap;
  word-break: break-word;
  font: 0.78rem/1.35 var(--font-mono);
  color: var(--text-main);
}

.danger-btn {
  border-color: rgba(239, 106, 106, 0.44);
}

.editor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.8rem;
}

.editor-nav-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.plres-editor-nav-group {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.plres-head-icon {
  width: var(--plres-btn-size, var(--icon-btn-size));
  height: var(--plres-btn-size, var(--icon-btn-size));
  min-width: var(--plres-btn-size, var(--icon-btn-size));
}

.plres-save-head {
  margin-right: 0.65rem;
}

.plres-head-icon svg {
  width: calc(var(--plres-btn-size, var(--icon-btn-size)) * var(--plres-icon-ratio, var(--icon-btn-ratio)));
  height: calc(var(--plres-btn-size, var(--icon-btn-size)) * var(--plres-icon-ratio, var(--icon-btn-ratio)));
  stroke-width: var(--plres-icon-stroke, var(--icon-btn-stroke));
}

#plres-sync-btn svg,
#plres-add-btn svg,
#plres-editor-photo-open svg,
#plres-editor-photo-camera svg {
  width: calc(var(--plres-btn-size, var(--icon-btn-size)) * var(--plres-icon-ratio, var(--icon-btn-ratio)));
  height: calc(var(--plres-btn-size, var(--icon-btn-size)) * var(--plres-icon-ratio, var(--icon-btn-ratio)));
  stroke-width: var(--plres-icon-stroke, var(--icon-btn-stroke));
}

.editor-head h2 {
  margin: 0;
}

.editor-form {
  display: grid;
  gap: 0.5rem;
  max-width: 620px;
}

.editor-form.full-editor {
  max-width: none;
}

.compact-editor {
  max-width: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem 0.8rem;
}

.compact-editor .field-span-2 {
  grid-column: 1 / -1;
}

.active-row {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface-1));
}

#page-tch .settings-card {
  margin-top: 0.7rem;
}

#page-tch textarea {
  font-family: var(--font-mono);
}

#page-tch .tch-action-btn {
  min-height: var(--icon-btn-size);
  padding: 0.5rem 0.82rem;
  background: var(--btn-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  font-weight: 600;
}

#page-tch .tch-action-btn:hover {
  background: var(--btn-bg-hover);
}

.operation-files-box {
  margin-top: 0;
}

.operation-files-box .panel-toolbar {
  align-items: center;
}

.tch-product-editor-form {
  max-width: none;
  gap: 0.7rem;
  width: 100%;
}

.tch-product-editor-form > .ghost-btn {
  justify-self: start;
}

.tch-product-editor-form .employee-editor-grid {
  grid-template-columns: minmax(0, 1fr) 220px;
  width: 100%;
}

.tch-product-editor-form .employee-photo-corner {
  justify-self: end;
  margin-left: auto;
}

.tch-approval-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.tch-approval-action-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.tch-approval-action-item > span {
  color: var(--text-dim);
  font-size: 0.82rem;
  white-space: nowrap;
}

.tch-approval-actions .icon-btn {
  width: var(--icon-btn-size);
  height: var(--icon-btn-size);
  min-width: var(--icon-btn-size);
}

.tch-approval-head {
  margin-bottom: 0.55rem;
}

.tch-approval-status {
  display: inline-flex;
  width: 1.45rem;
  height: 1.45rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.tch-approval-status.ok {
  background: color-mix(in srgb, #1c9e49 22%, transparent);
  color: #1c9e49;
  border-color: color-mix(in srgb, #1c9e49 52%, var(--panel-border));
}

.tch-approval-status.reject {
  background: color-mix(in srgb, #c54444 22%, transparent);
  color: #c54444;
  border-color: color-mix(in srgb, #c54444 52%, var(--panel-border));
}

.tch-approval-status.pending {
  color: var(--text-dim);
}

.tch-node-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}

.tch-node-delete-btn {
  margin-left: 0.55rem;
}

.tch-operations-head {
  margin-bottom: 0.55rem;
}

.tch-chat-compose-row textarea {
  margin: 0;
  min-height: 5rem;
}

.editor-row {
  display: grid;
  gap: 0.5rem 0.7rem;
}

.editor-row > .span-2 {
  grid-column: span 2;
}

.editor-form > .full-width {
  display: grid;
  gap: 0.35rem;
}

.editor-row.two-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.editor-row.three-cols {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.editor-row.four-cols {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.editor-row.mmnf-five-cols {
  grid-template-columns: 1fr repeat(4, minmax(0, 0.75fr));
}

.editor-row.six-cols {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.editor-row > .span-2 {
  grid-column: span 2;
}

.editor-row > .span-3 {
  grid-column: span 3;
}

.editor-row > .span-4 {
  grid-column: span 4;
}

.mmnf-editor-date-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 0.7rem;
}

.mmnf-editor-date-pair > label {
  margin: 0;
}

.tch-node-editor-form {
  max-width: none;
  gap: 0.7rem;
}

.tch-rich-card {
  margin-top: 0;
}

.tch-rich-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
  padding-bottom: 0;
}

.tch-rich-toolbar > * {
  flex: 0 0 auto;
}

.tch-rich-toolbar-group {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.18rem 0.2rem;
  border: 1px solid color-mix(in srgb, var(--panel-border) 88%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-2) 92%, white 8%);
}

.tch-rich-toolbar-group-images {
  margin-left: 0.2rem;
  padding-left: 0.45rem;
  box-shadow: inset 1px 0 0 color-mix(in srgb, var(--panel-border) 88%, transparent);
}

.tch-rich-toolbar input,
.tch-rich-toolbar select,
.tch-rich-toolbar button {
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  flex: 0 0 auto !important;
}

.tch-rich-size {
  width: 58px;
  min-width: 58px;
  max-width: 58px;
  font-size: 13px;
  padding: 0.26rem 0.3rem;
}

.tch-rich-color {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--panel-border);
  background: var(--surface-2);
  border-radius: 999px;
}

.tch-rich-toolbar select.tch-rich-size {
  width: 54px !important;
  min-width: 54px !important;
  max-width: 54px !important;
  padding: 0.24rem 0.28rem !important;
}

.tch-rich-toolbar input.tch-rich-color {
  width: 30px !important;
  min-width: 30px !important;
  max-width: 30px !important;
  height: 30px !important;
  padding: 0 !important;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 999px !important;
}

.tch-rich-toolbar input.tch-rich-color::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 999px;
}

.tch-rich-toolbar input.tch-rich-color::-webkit-color-swatch {
  border: none;
  border-radius: 999px;
}

.tch-rich-toolbar input.tch-rich-color::-moz-color-swatch {
  border: none;
  border-radius: 999px;
}

.tch-rich-toolbar .icon-btn {
  min-width: 30px !important;
  max-width: 30px !important;
  width: 30px !important;
  min-height: 30px !important;
  max-height: 30px !important;
  height: 30px !important;
  padding: 0 !important;
  font-size: 13px;
  border-radius: 999px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1;
}

.tch-rich-toolbar .icon-btn.is-active {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-3));
  border-color: color-mix(in srgb, var(--accent) 42%, var(--panel-border));
  color: color-mix(in srgb, var(--accent-strong, var(--accent)) 86%, black);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}

.tch-rich-toolbar .icon-btn.tch-rich-undo-btn {
  font-size: 16px;
  font-weight: 700;
}

.tch-rich-sections {
  display: grid;
  gap: 0.45rem;
}

.tch-rich-section {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 0.2rem 0.5rem 0.5rem;
  background: var(--surface-3);
}

.tch-rich-section > summary {
  cursor: pointer;
  color: var(--text-main);
  font-weight: 600;
  margin: 0.2rem 0;
}

.tch-rich-editor {
  min-height: 86px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 0.55rem;
  background: var(--surface-2);
  overflow: auto;
  font-family: "PT Serif", Georgia, serif;
}

.tch-rich-editor:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 38%, transparent);
}

.tch-rich-image-wrap {
  position: relative;
  display: inline-block;
  width: 240px;
  height: 160px;
  max-width: 100%;
  border: 1px dashed transparent;
  vertical-align: top;
  user-select: none;
  touch-action: none;
}

.tch-rich-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.tch-rich-image-wrap .tch-img-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--accent) 60%, white);
  border: 1px solid color-mix(in srgb, var(--accent) 70%, #000);
  opacity: 0;
  pointer-events: none;
}

.tch-rich-image-wrap .tch-img-handle.tl { top: -7px; left: -7px; cursor: nwse-resize; }
.tch-rich-image-wrap .tch-img-handle.tr { top: -7px; right: -7px; cursor: nesw-resize; }
.tch-rich-image-wrap .tch-img-handle.bl { bottom: -7px; left: -7px; cursor: nesw-resize; }
.tch-rich-image-wrap .tch-img-handle.br { bottom: -7px; right: -7px; cursor: nwse-resize; }

.tch-rich-image-wrap.tch-rich-selected .tch-img-handle {
  opacity: 1;
  pointer-events: auto;
}

.tch-rich-image-wrap.tch-rich-selected {
  outline: 2px solid color-mix(in srgb, var(--accent) 44%, transparent);
  outline-offset: 1px;
  border-color: color-mix(in srgb, var(--accent) 42%, transparent);
}

.employee-editor-form {
  max-width: none;
  width: 100%;
}

.employee-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  gap: 0.9rem;
  align-items: start;
}

.employee-editor-fields {
  display: grid;
  gap: 0.5rem;
}

.employee-editor-row-head {
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr) minmax(170px, 230px);
}

.employee-editor-row-position {
  grid-template-columns: minmax(0, 1fr) minmax(120px, 190px) minmax(120px, 190px);
}

.position-editor-form {
  max-width: none;
  width: 100%;
  gap: 0.7rem;
}

.employee-photo-box {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 0.45rem;
  background: var(--surface-3);
}

.employee-photo-corner {
  justify-self: end;
  width: 200px;
  min-height: 240px;
  display: grid;
  gap: 0.5rem;
  justify-items: stretch;
}

.employee-photo-stage {
  position: relative;
  width: 190px;
  height: 230px;
}

#employee-editor-photo-preview,
#tch-editor-photo-preview,
#tch-spec-photo-preview,
#plres-editor-photo-preview,
#employee-editor-camera-video,
#tch-editor-camera-video,
#tch-spec-camera-video,
#plres-editor-camera-video,
.employee-photo-empty {
  position: absolute;
  inset: 0;
  width: 190px;
  height: 230px;
  border-radius: 8px;
}

.employee-photo-empty {
  border: 1px dashed var(--panel-border);
  background:
    radial-gradient(circle at 50% 34%, color-mix(in srgb, var(--accent) 36%, transparent) 0 26px, transparent 27px),
    linear-gradient(color-mix(in srgb, var(--accent) 28%, transparent), color-mix(in srgb, var(--accent) 10%, transparent));
}

#tch-editor-photo-empty {
  border: 1px dashed var(--panel-border);
  background: var(--surface-2);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.55rem;
}

#tch-editor-photo-empty span {
  font-size: 0.9rem;
  font-weight: 600;
}

#plres-editor-photo-empty {
  border: 1px dashed var(--panel-border);
  background: var(--surface-2);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.55rem;
}

#plres-editor-photo-empty span {
  font-size: 0.9rem;
  font-weight: 600;
}

#tch-spec-photo-empty {
  border: 1px dashed var(--panel-border);
  background: var(--surface-2);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.55rem;
}

#tch-spec-photo-empty span {
  font-size: 0.9rem;
  font-weight: 600;
}

#employee-editor-photo-preview {
  object-fit: contain;
  object-position: center;
  background: var(--surface-2);
  border: 1px solid var(--panel-border);
  z-index: 1;
}

#employee-editor-photo-empty {
  border: 1px dashed var(--panel-border);
  background: var(--surface-2);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.55rem;
  font-size: 0.9rem;
  font-weight: 600;
}

#tch-editor-photo-preview {
  object-fit: contain;
  object-position: center;
  background: var(--surface-2);
  border: 1px solid var(--panel-border);
  z-index: 1;
}

#tch-spec-photo-preview {
  object-fit: contain;
  object-position: center;
  background: var(--surface-2);
  border: 1px solid var(--panel-border);
  z-index: 1;
}

#plres-editor-photo-preview {
  object-fit: contain;
  object-position: center;
  background: var(--surface-2);
  border: 1px solid var(--panel-border);
  z-index: 1;
}

.plres-photo-icon {
  width: var(--plres-btn-size, var(--icon-btn-size));
  height: var(--plres-btn-size, var(--icon-btn-size));
  min-width: var(--plres-btn-size, var(--icon-btn-size));
}

#plres-editor-photo-actions {
  position: absolute;
  right: 0.35rem;
  bottom: 0.35rem;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

#employee-editor-photo-actions {
  position: absolute;
  right: 0.35rem;
  bottom: 0.35rem;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

#tch-spec-photo-actions {
  position: absolute;
  right: 0.35rem;
  bottom: 0.35rem;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

#tch-editor-photo-actions {
  position: absolute;
  right: 0.35rem;
  bottom: 0.35rem;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

#employee-editor-photo-file,
#plres-editor-photo-file {
  width: 100%;
}

.employee-photo-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}

.icon-btn {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--btn-bg);
  color: var(--text-main);
  cursor: pointer;
  width: var(--icon-btn-size);
  height: var(--icon-btn-size);
  min-width: var(--icon-btn-size);
  min-height: var(--icon-btn-size);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  line-height: 1;
}

.icon-btn svg {
  width: calc(var(--icon-btn-size) * var(--icon-btn-ratio));
  height: calc(var(--icon-btn-size) * var(--icon-btn-ratio));
  stroke: currentColor;
  fill: none;
  stroke-width: var(--icon-btn-stroke);
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}

.employee-photo-actions .icon-btn {
  width: 100%;
  min-width: 0;
}

#employee-editor-photo-actions .icon-btn,
#tch-spec-photo-actions .icon-btn,
#plres-editor-photo-actions .icon-btn,
#tch-editor-photo-actions .icon-btn {
  width: var(--icon-btn-size);
  height: var(--icon-btn-size);
  min-width: var(--icon-btn-size);
  background: var(--btn-bg);
}

#employee-editor-photo-actions .icon-btn:hover,
#tch-spec-photo-actions .icon-btn:hover,
#plres-editor-photo-actions .icon-btn:hover,
#tch-editor-photo-actions .icon-btn:hover {
  background: var(--btn-bg-hover);
}

#page-plres .icon-btn.plres-circle-icon svg,
#page-plres-editor .icon-btn.plres-circle-icon svg,
#page-plres-editor .icon-btn.plres-head-icon svg,
#page-tch .icon-btn.plres-circle-icon svg,
#page-tch .icon-btn.plres-head-icon svg {
  width: calc(var(--plres-btn-size) * var(--plres-icon-ratio));
  height: calc(var(--plres-btn-size) * var(--plres-icon-ratio));
  stroke-width: var(--plres-icon-stroke);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn:hover {
  background: var(--btn-bg-hover);
}

.ghost-btn:disabled,
.bookmark-tab:disabled,
.icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

#employee-editor-photo-camera,
#employee-editor-camera-shot,
#employee-editor-camera-stop {
  width: 100%;
}

#employee-editor-camera-video {
  object-fit: cover;
  border: 1px solid var(--panel-border);
  background: #000;
  z-index: 2;
}

#tch-editor-camera-video {
  object-fit: cover;
  border: 1px solid var(--panel-border);
  background: #000;
  z-index: 2;
}

.employee-camera-actions {
  display: grid;
  gap: 0.35rem;
}

.employee-camera-actions.module-hidden {
  display: none;
}

.drop-zone-active {
  border-color: color-mix(in srgb, var(--accent) 78%, var(--panel-border));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-2));
}

.employee-roles-box {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 0.55rem;
  background: var(--surface-3);
}

.roles-title {
  margin: 0 0 0.45rem;
  color: var(--text-main);
}

.employee-roles-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem 0.7rem;
}

.employee-role-item {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.2rem 0.1rem 0.2rem 0.35rem;
}

.editor-form label.employee-role-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0;
}

.employee-role-item span {
  flex: 1;
}

.employee-role-item input {
  width: 1rem;
  height: 1rem;
  margin: 0 0.15rem 0 0;
  flex: 0 0 auto;
}

.employee-account-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.employee-account-head .roles-title {
  margin: 0;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.checkbox-line input {
  width: auto;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  border: 1px solid rgba(123, 211, 137, 0.35);
  background: rgba(10, 32, 24, 0.95);
  color: #c7f5d1;
  padding: 0.72rem 0.86rem;
  border-radius: 10px;
  transform: translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.style-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  border: 1px solid var(--panel-border);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 0.18rem;
}

.style-btn {
  min-width: 2rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  border-radius: 8px;
  padding: 0.2rem 0.35rem;
  font: 600 0.82rem/1 var(--font-mono);
  cursor: pointer;
}

.style-btn.active {
  color: var(--text-main);
  border-color: var(--panel-border);
  background: color-mix(in srgb, var(--accent) 26%, transparent);
}

html[data-style="4"] .ambient-lines {
  background-image:
    linear-gradient(90deg, rgba(113, 104, 87, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(113, 104, 87, 0.06) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: none;
}

html[data-style="4"] .main-table th {
  border-bottom-width: 2px;
  letter-spacing: 0.04em;
}

html[data-style="6"] .panel,
html[data-style="6"] .top-chip,
html[data-style="6"] .style-switcher,
html[data-style="6"] .module-btn,
html[data-style="6"] .bookmark-tab,
html[data-style="6"] .ghost-btn {
  border-width: 1.5px;
}

html[data-style="6"] .main-table th,
html[data-style="6"] .main-table td {
  border-bottom-color: color-mix(in srgb, var(--accent) 35%, var(--panel-border));
}

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

.position-employees-box,
.discussion-box {
  margin-top: 0.8rem;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 0.75rem;
  background: color-mix(in srgb, var(--surface-2) 86%, transparent);
}

.position-employees-box h3,
.discussion-box h3 {
  margin: 0 0 0.55rem;
}

.discussion-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.ncfi-head-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.plres-chat-head-icon {
  width: var(--plres-btn-size, var(--icon-btn-size));
  height: var(--plres-btn-size, var(--icon-btn-size));
  min-width: var(--plres-btn-size, var(--icon-btn-size));
}

.discussion-messages {
  max-height: 280px;
  overflow: auto;
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
  padding-right: 0.2rem;
}

.discussion-message {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  background: var(--surface-1);
}

.discussion-message p {
  margin: 0.35rem 0 0;
  white-space: pre-wrap;
}

.discussion-message-head {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.86rem;
  color: var(--text-dim);
}

.discussion-own {
  padding: 0.06rem 0.35rem;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  color: var(--text-main);
}

.discussion-attachments {
  margin: 0.35rem 0 0;
  padding-left: 1rem;
}

.discussion-attachments a {
  word-break: break-word;
}

.discussion-image {
  display: block;
  margin-top: 0.42rem;
  max-width: min(280px, 100%);
  max-height: 220px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  object-fit: cover;
}

.chat-compose-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-attach-btn {
  width: var(--icon-btn-size);
  height: var(--icon-btn-size);
  min-width: var(--icon-btn-size);
  padding: 0;
  font-size: 1rem;
}

.chat-pending-files {
  margin-top: 0.3rem;
  min-height: 1.1rem;
  word-break: break-word;
}

.plres-chat-compose-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: end;
}

.plres-chat-compose-row textarea {
  margin: 0;
  min-height: 5rem;
}

.plres-chat-compose-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  justify-self: end;
}

.plres-chat-send-btn,
#plres-chat-attach {
  width: var(--plres-btn-size, var(--icon-btn-size));
  height: var(--plres-btn-size, var(--icon-btn-size));
  min-width: var(--plres-btn-size, var(--icon-btn-size));
}

.mention-box {
  display: grid;
  gap: 0.25rem;
  margin-top: -0.25rem;
  margin-bottom: 0.35rem;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 0.35rem;
  max-height: 180px;
  overflow-y: auto;
}

.mention-box.module-hidden {
  display: none;
}

.mention-item {
  text-align: left;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-main);
  padding: 0.28rem 0.35rem;
  cursor: pointer;
  font: inherit;
}

.mention-item:hover,
.mention-item.active {
  border-color: var(--panel-border);
  background: var(--row-hover);
}

.discussion-message-highlight {
  border-color: color-mix(in srgb, var(--accent) 65%, var(--panel-border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent);
}

.mmnf-program-table td,
.mmnf-program-table th {
  text-align: center;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
  hyphens: none;
}

.mmnf-program-table {
  table-layout: fixed;
}

.mmnf-program-table td:nth-child(2),
.mmnf-program-table td:nth-child(3),
.mmnf-program-table td:nth-child(4),
.mmnf-program-table td:nth-child(5),
.mmnf-program-table td:nth-child(6) {
  text-align: left;
}

.mmnf-program-task-row td {
  font-weight: 700;
  background: color-mix(in srgb, var(--surface-2) 76%, var(--accent) 24%);
}

.mmnf-program-op-row td {
  background: transparent;
}

.mmnf-program-weekend {
  background: color-mix(in srgb, var(--surface-2) 74%, #8b949e 26%) !important;
}

.mmnf-program-plan {
  background: color-mix(in srgb, #4d8ac4 18%, var(--surface-2) 82%) !important;
}

.mmnf-program-ok {
  background: color-mix(in srgb, #2e9b48 18%, var(--surface-2) 82%) !important;
}

.mmnf-program-warn {
  background: color-mix(in srgb, #d5a72a 28%, var(--surface-2) 72%) !important;
}

.mmnf-program-order-cell {
  padding: 0.08rem 0.06rem !important;
  vertical-align: middle;
  line-height: 0 !important;
}

.mmnf-program-table td.mmnf-program-order-cell:not(.mmnf-program-weekend) {
  background: transparent !important;
}

.mmnf-program-table td.mmnf-program-order-cell.mmnf-program-weekend {
  background: color-mix(in srgb, var(--surface-2) 74%, #8b949e 26%) !important;
}

.mmnf-program-order-box {
  width: 100%;
  height: 1.28rem;
  min-height: 1.28rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.4px solid #4f79a3;
  border-left-width: 0;
  border-right-width: 0;
  border-radius: 0;
  background: rgba(79, 121, 163, 0.12);
  overflow: hidden;
  box-sizing: border-box;
}

.mmnf-program-order-box.mmnf-program-order-start {
  border-left-width: 1.4px;
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
}

.mmnf-program-order-box.mmnf-program-order-end {
  border-right-width: 1.4px;
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
}

.mmnf-program-order-status-planned {
  background: rgba(108, 112, 118, 0.34);
  border-color: rgba(83, 87, 93, 0.92);
}

.mmnf-program-order-status-issued {
  background: rgba(137, 201, 255, 0.34);
  border-color: rgba(83, 146, 201, 0.9);
}

.mmnf-program-order-status-in-progress {
  background: rgba(56, 125, 199, 0.34);
  border-color: rgba(40, 94, 152, 0.92);
}

.mmnf-program-order-status-wait-otk {
  background: rgba(215, 176, 58, 0.36);
  border-color: rgba(166, 122, 22, 0.92);
}

.mmnf-program-order-status-partial-otk {
  background: rgba(230, 129, 129, 0.32);
  border-color: rgba(190, 92, 92, 0.9);
}

.mmnf-program-order-status-closed {
  background: rgba(83, 176, 96, 0.36);
  border-color: rgba(53, 130, 64, 0.92);
}

.mmnf-program-order-status-closed-partial {
  background: rgba(231, 145, 64, 0.35);
  border-color: rgba(184, 106, 35, 0.92);
}

.mmnf-program-order-status-cancelled {
  background: rgba(132, 136, 142, 0.28);
  border-color: rgba(102, 107, 113, 0.92);
  position: relative;
}

.mmnf-program-order-status-cancelled::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  border-top: 1.8px solid rgba(60, 63, 68, 0.9);
  transform: translateY(-50%);
  pointer-events: none;
}

.mmnf-order-status-cell {
  white-space: nowrap;
  text-align: center;
  padding-top: 0.28rem !important;
  padding-bottom: 0.28rem !important;
}

.mmnf-order-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.6rem;
  padding: 0.12rem 0.5rem;
  border: 1.3px solid rgba(90, 95, 102, 0.55);
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1;
  white-space: nowrap;
  box-sizing: border-box;
  position: relative;
}

.mmnf-order-status-cell.mmnf-order-status-planned .mmnf-order-status-pill {
  background: rgba(108, 112, 118, 0.34);
  border-color: rgba(83, 87, 93, 0.92);
}

.mmnf-order-status-cell.mmnf-order-status-issued .mmnf-order-status-pill {
  background: rgba(137, 201, 255, 0.34);
  border-color: rgba(83, 146, 201, 0.9);
}

.mmnf-order-status-cell.mmnf-order-status-in-progress .mmnf-order-status-pill {
  background: rgba(56, 125, 199, 0.34);
  border-color: rgba(40, 94, 152, 0.92);
}

.mmnf-order-status-cell.mmnf-order-status-wait-otk .mmnf-order-status-pill {
  background: rgba(215, 176, 58, 0.36);
  border-color: rgba(166, 122, 22, 0.92);
}

.mmnf-order-status-cell.mmnf-order-status-partial-otk .mmnf-order-status-pill {
  background: rgba(230, 129, 129, 0.32);
  border-color: rgba(190, 92, 92, 0.9);
}

.mmnf-order-status-cell.mmnf-order-status-closed .mmnf-order-status-pill {
  background: rgba(83, 176, 96, 0.36);
  border-color: rgba(53, 130, 64, 0.92);
}

.mmnf-order-status-cell.mmnf-order-status-closed-partial .mmnf-order-status-pill {
  background: rgba(231, 145, 64, 0.35);
  border-color: rgba(184, 106, 35, 0.92);
}

.mmnf-order-status-cell.mmnf-order-status-cancelled .mmnf-order-status-pill {
  background: rgba(132, 136, 142, 0.28);
  border-color: rgba(102, 107, 113, 0.92);
  text-decoration: line-through;
  text-decoration-thickness: 1.8px;
  text-decoration-color: rgba(60, 63, 68, 0.9);
}

.mmnf-program-table th:nth-child(n + 7),
.mmnf-program-table td:nth-child(n + 7) {
  width: 1.85rem;
  min-width: 1.85rem;
  max-width: 1.85rem;
  padding-left: 0.08rem;
  padding-right: 0.08rem;
}

.mmnf-program-table td:nth-child(n + 7) {
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1;
}

.mmnf-program-table td:nth-child(4),
.mmnf-program-table td:nth-child(5),
.mmnf-program-table td:nth-child(6) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mmnf-program-order-cell .mmnf-program-qty-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  margin: 0;
  max-width: 100%;
  padding: 0 0.06rem;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.84em;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

.mmnf-program-order-cell .mmnf-program-qty-link.mmnf-program-qty-xs1 {
  font-size: 0.76em;
}

.mmnf-program-order-cell .mmnf-program-qty-link.mmnf-program-qty-xs2 {
  font-size: 0.68em;
}

.mmnf-program-order-cell .mmnf-program-qty-link:hover {
  color: inherit;
}

.mmnf-program-order-status-cancelled .mmnf-program-qty-link {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: rgba(54, 58, 63, 0.9);
}

.mmnf-program-item-box {
  display: inline;
  font-weight: 600;
  font-size: inherit;
  line-height: 1;
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  min-height: 0;
}

.mmnf-program-item-ready-green {
  color: #2f8a3b;
}

.mmnf-program-item-ready-yellow {
  color: #b57d14;
}

.mmnf-program-item-ready-red {
  color: #b13d3d;
}

.mmnf-program-qty-link {
  font: inherit;
  color: inherit;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.05;
}

.mmnf-program-qty-link:hover {
  color: var(--accent);
}

.mmnf-timesheet-table td,
.mmnf-timesheet-table th {
  text-align: center;
  white-space: nowrap;
  overflow-wrap: normal;
}

.mmnf-timesheet-table {
  table-layout: fixed;
}

.mmnf-timesheet-table td:first-child,
.mmnf-timesheet-table th:first-child {
  text-align: left;
  width: 10rem;
  min-width: 10rem;
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mmnf-timesheet-table td:nth-child(2),
.mmnf-timesheet-table th:nth-child(2) {
  width: 4.9rem;
  min-width: 4.9rem;
  max-width: 4.9rem;
}

.mmnf-timesheet-table th:nth-child(n + 3),
.mmnf-timesheet-table td:nth-child(n + 3) {
  width: 2rem;
  min-width: 2rem;
  max-width: 2rem;
}

.mmnf-timesheet-table td.mmnf-timesheet-cell-plan_under {
  color: #b13d3d;
  font-weight: 600;
}

.mmnf-timesheet-table td.mmnf-timesheet-cell-plan_over {
  color: #b57d14;
  font-weight: 600;
}

.mmnf-timesheet-table td.mmnf-timesheet-cell-done_good {
  color: #2f8a3b;
  font-weight: 600;
}

.mmnf-timesheet-table td.mmnf-timesheet-cell-done_bad {
  color: #b13d3d;
  font-weight: 600;
}

#mmnf-timesheet-view {
  width: 6.2rem !important;
  min-width: 6.2rem;
  font: inherit;
  color: var(--text-main);
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: var(--surface-2);
  padding: 0.62rem 0.72rem;
}

#otk-timesheet-view {
  font: inherit;
  color: var(--text-main);
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: var(--surface-2);
  padding: 0.62rem 0.72rem;
}

.mmnf-editor-top-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-right: 0.65rem;
  padding-right: 0.65rem;
  border-right: 1px solid var(--panel-border);
}

.mmnf-editor-action-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.mmnf-history-detail {
  margin-top: 0.6rem;
}

.mmnf-history-detail h4 {
  margin-top: -2px;
  margin-bottom: 0.35rem;
}

.mmnf-history-detail-note {
  display: grid;
  gap: 0.4rem;
}

.mmnf-history-note-box {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--surface-1);
  padding: 0.5rem 0.6rem;
  min-height: 2.4rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.mmnf-history-detail-media {
  margin-top: 0.5rem;
  display: grid;
  gap: 0.45rem;
}

.mmnf-history-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.5rem;
}

.mmnf-history-media-item {
  position: relative;
}

.mmnf-history-media-grid a {
  display: block;
  text-decoration: none;
}

.mmnf-history-media-grid img {
  width: 100%;
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--surface-1);
}

.mmnf-history-file-list {
  display: grid;
  gap: 0.26rem;
}

.mmnf-history-file-row a {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#mmnf-action-box {
  margin-top: 0.65rem;
}

.mmnf-action-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.mmnf-action-head h3 {
  margin: 0.1rem 0 0;
}

.mmnf-action-head-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 0.45rem;
}

.mmnf-action-input-wrap {
  display: inline-flex !important;
  grid-template-columns: none;
  gap: 0;
  flex-direction: row;
  justify-content: center;
  align-items: stretch !important;
  min-width: 11rem;
  height: var(--icon-btn-size);
  margin: 0;
  padding: 0;
  line-height: 1;
  align-self: center !important;
  vertical-align: middle;
}

.mmnf-action-input-wrap.module-hidden {
  display: none !important;
}

.mmnf-action-input-wrap > span {
  display: none;
}

.mmnf-action-input-wrap input {
  min-width: 11rem;
  height: 100%;
  margin: 0;
  box-sizing: border-box;
  align-self: stretch;
  line-height: normal;
}

.mmnf-action-head-controls .icon-btn {
  height: var(--icon-btn-size);
  width: var(--icon-btn-size);
  align-self: center;
  margin: 0;
}

.mmnf-action-head-controls > * {
  margin: 0 !important;
  align-self: center !important;
}

.mmnf-action-layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(260px, 1fr);
  gap: 0.75rem;
  margin-top: 0.65rem;
}

.mmnf-action-note-pane {
  min-width: 0;
}

.mmnf-action-note-pane > label {
  display: grid;
  gap: 0.28rem;
}

.mmnf-action-note-pane > label > textarea {
  min-height: 9rem;
  resize: vertical;
}

.mmnf-action-toolbar {
  margin-top: 0.22rem;
  margin-bottom: 0.45rem;
}

.mmnf-action-note-rich {
  min-height: 15rem;
  cursor: text;
}

#mmnf-action-qr-camera-wrap {
  display: grid;
  gap: 0.42rem;
  align-content: start;
}

.mmnf-action-video-wrap {
  position: relative;
}

#mmnf-action-qr-video {
  width: 100%;
  min-height: 14rem;
  max-height: 22rem;
  object-fit: cover;
  border: 1px dashed var(--panel-border);
  border-radius: 10px;
  background: var(--surface-2);
}

.mmnf-action-video-actions {
  position: absolute;
  right: 0.45rem;
  bottom: 0.45rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
  z-index: 2;
}

.mmnf-action-video-actions .icon-btn {
  background: color-mix(in srgb, var(--surface-2) 78%, #ffffff 22%);
}

.mmnf-action-description-media {
  margin-top: 0.5rem;
  display: grid;
  gap: 0.45rem;
}

.mmnf-action-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 0.45rem;
}

.mmnf-action-media-item {
  position: relative;
}

.mmnf-action-media-item img {
  width: 100%;
  max-height: 120px;
  object-fit: cover;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
}

.mmnf-action-file-list {
  display: grid;
  gap: 0.32rem;
}

.mmnf-action-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.mmnf-action-file-row a {
  color: var(--text-main);
  text-decoration: underline;
  overflow-wrap: anywhere;
}

.mmnf-action-attach-remove {
  width: 1.85rem;
  height: 1.85rem;
  min-width: 1.85rem;
  min-height: 1.85rem;
  border-radius: 999px;
  border: 1px solid var(--danger);
  color: var(--danger);
  background: color-mix(in srgb, var(--surface-2) 92%, #ffffff 8%);
  font-size: 0.95rem;
  line-height: 1;
}

.mmnf-action-media-item > .mmnf-action-attach-remove {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
}

#mmnf-history-body tr.selected td {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-2) 82%) !important;
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--accent) 35%, transparent),
    inset 0 -1px 0 color-mix(in srgb, var(--accent) 35%, transparent);
}

#mmnf-action-box .plres-chat-compose-row {
  align-items: flex-end;
}

@media (max-width: 1100px) {
  .mmnf-action-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr;
  }

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

  #settings-ai-form {
    grid-template-columns: 1fr;
  }

  .settings-ai-chat-message {
    max-width: 100%;
  }

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

@media (max-width: 720px) {
  .main-content {
    padding: 0.8rem;
  }

  .bookmarks {
    flex-wrap: wrap;
  }

  .panel-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .employees-toolbar {
    flex-wrap: wrap;
  }

  .employees-toolbar #employees-search {
    max-width: 100%;
    width: 100%;
  }

  .mpers-toolbar > input {
    max-width: 100%;
    width: 100%;
  }

  .mpers-toolbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .employee-editor-grid {
    grid-template-columns: 1fr;
  }

  .employee-photo-corner {
    justify-self: start;
  }

  .editor-row.two-cols {
    grid-template-columns: 1fr;
  }

  .editor-row.three-cols {
    grid-template-columns: 1fr;
  }

  .editor-row.four-cols {
    grid-template-columns: 1fr;
  }

  .editor-row.mmnf-five-cols {
    grid-template-columns: 1fr;
  }

  .editor-row.six-cols {
    grid-template-columns: 1fr;
  }

  .mmnf-editor-date-pair {
    grid-template-columns: 1fr;
  }

  .editor-row > .span-2,
  .editor-row > .span-3,
  .editor-row > .span-4 {
    grid-column: span 1;
  }

  .employee-editor-row-head,
  .employee-editor-row-position {
    grid-template-columns: 1fr;
  }

  .employee-roles-grid {
    grid-template-columns: 1fr;
  }
}
