:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --ink: #172026;
  --muted: #64717b;
  --line: #dce3e7;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --warn: #b45309;
  --danger: #b91c1c;
  --ok: #047857;
  --soft: #e8f3f1;
  --shadow: 0 18px 50px rgba(25, 38, 45, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

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

.app-shell {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 24% 18%, rgba(15, 118, 110, 0.16), transparent 28%),
    linear-gradient(135deg, #f7fafb 0%, #eef5f4 48%, #f6f8f9 100%);
  background-size: cover;
  background-position: center;
}

.login-card {
  display: grid;
  gap: 16px;
  width: min(100%, 430px);
  padding: 28px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #dce6e8;
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(25, 38, 45, 0.13);
}

.login-card h1 {
  margin-bottom: 0;
  color: var(--ink);
  font-size: 34px;
}

.login-card .lead {
  color: var(--muted);
}

.login-brand {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 2px;
}

.brand-symbol {
  display: block;
  flex: 0 0 auto;
  object-fit: contain;
}

.login-symbol {
  width: 56px;
  height: 56px;
}

.header-symbol {
  width: 46px;
  height: 46px;
}

.brand-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.brand-name {
  margin: 0;
  color: #111827;
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.brand-name span {
  font: inherit;
  line-height: inherit;
  color: #f0448f;
}

.topbar .brand-name span,
.station-brand .brand-name span {
  color: #f0448f;
  font: inherit;
  line-height: inherit;
}

.login-brand .brand-name {
  font-size: 14px;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 0;
}

.system-login-card {
  width: min(100%, 520px);
}

.role-guide {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.role-guide span {
  display: grid;
  place-items: center;
  min-height: 34px;
  padding: 6px;
  background: #f3f7f8;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #2b3a42;
  font-size: 12px;
  font-weight: 800;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
  padding: 14px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.topbar div,
.topbar nav {
  display: flex;
  gap: 12px;
  align-items: center;
}

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

.hero {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  align-items: end;
  min-height: 220px;
  padding: 36px;
  background:
    linear-gradient(120deg, rgba(10, 93, 86, 0.94), rgba(26, 54, 67, 0.88)),
    url("https://images.unsplash.com/photo-1450101499163-c8848c66ca85?auto=format&fit=crop&w=1600&q=80");
  background-size: cover;
  background-position: center;
  color: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 12px;
  color: #c9e7e3;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 14px;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.08;
  letter-spacing: 0;
}

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

.lead {
  max-width: 760px;
  margin-bottom: 0;
  color: #e8f4f3;
  line-height: 1.8;
}

.hero-status {
  display: grid;
  gap: 8px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  backdrop-filter: blur(14px);
}

.hero-status .secondary-button {
  width: 100%;
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.88);
}

.hero-status span,
.hero-status small {
  color: #dcefed;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 24px;
  align-items: start;
  margin-top: 24px;
}

.panel,
.wage-card,
.output-box,
.summary-strip,
.check-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(25, 38, 45, 0.05);
}

.input-panel {
  position: sticky;
  top: 20px;
  display: grid;
  gap: 18px;
  padding: 22px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.panel-head span,
.summary-strip span {
  color: var(--muted);
  font-size: 13px;
}

.panel-head > span {
  display: none;
}

.drop-zone {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 132px;
  padding: 22px;
  border: 1.5px dashed #95aaa8;
  border-radius: 8px;
  background: var(--soft);
  cursor: pointer;
  text-align: center;
}

.drop-zone input {
  max-width: 100%;
  height: auto;
  padding: 9px;
  cursor: pointer;
}

.drop-zone.dragging {
  border-color: var(--accent);
  background: #dff0ed;
}

.drop-zone small {
  color: var(--muted);
}

.read-status {
  margin: -8px 0 0;
  padding: 10px 12px;
  background: #f3f7f8;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.read-status:empty {
  display: none;
}

.read-status.ok {
  background: #e7f6ee;
  border-color: #b8e4cd;
  color: var(--ok);
}

.read-status.error {
  background: #fdecec;
  border-color: #facaca;
  color: var(--danger);
}

.sub-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: #f8fbfb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.button-row .primary-button {
  height: 40px;
}

.drive-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  color: var(--muted);
  font-size: 13px;
}

.drive-file {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.drive-file:hover {
  border-color: var(--accent);
}

.drive-file span {
  color: var(--muted);
  font-size: 12px;
}

.drop-title {
  color: var(--accent-dark);
  font-size: 18px;
  font-weight: 800;
}

.drop-sub {
  color: var(--muted);
}

.field {
  display: grid;
  gap: 8px;
  color: #2b3a42;
  font-size: 13px;
  font-weight: 700;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid #cdd7dc;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

textarea {
  min-height: 180px;
  resize: vertical;
  padding: 12px;
  line-height: 1.7;
}

input,
select {
  height: 42px;
  padding: 0 11px;
}

input[type="file"] {
  height: 46px;
  padding: 5px;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

input[type="file"]::file-selector-button {
  height: 34px;
  margin-right: 12px;
  padding: 0 16px;
  border: 0;
  border-radius: 6px;
  background: #e5ecef;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

input[type="file"]::-webkit-file-upload-button {
  height: 34px;
  margin-right: 12px;
  padding: 0 16px;
  border: 0;
  border-radius: 6px;
  background: #e5ecef;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

input[type="file"]:hover::file-selector-button,
input[type="file"]:hover::-webkit-file-upload-button {
  background: #dbe5e8;
}

.dropzone input[type="file"] {
  max-width: 420px;
  margin: 0 auto;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.primary-button,
.secondary-button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  height: 48px;
  background: var(--accent);
  color: #fff;
}

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

.secondary-button {
  height: 36px;
  padding: 0 14px;
  background: #e5ecef;
  color: #26343b;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.full-button {
  width: 100%;
}

.results {
  display: grid;
  gap: 18px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
}

.summary-strip div {
  display: grid;
  gap: 6px;
  padding: 18px;
  background: #fff;
}

.summary-strip strong {
  font-size: 24px;
}

.wage-card {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  padding: 22px;
  border-left: 5px solid var(--accent);
}

.wage-card.warning {
  border-left-color: var(--danger);
}

.multi-person-alert {
  padding: 16px 18px;
  background: #fdecec;
  border: 1px solid #facaca;
  border-left: 5px solid var(--danger);
  border-radius: 8px;
  color: var(--danger);
  font-weight: 800;
  line-height: 1.7;
  white-space: pre-wrap;
}

.wage-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

dl div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  font-weight: 800;
}

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

.check-item {
  display: grid;
  grid-template-columns: 176px 1fr;
  gap: 18px;
  padding: 18px;
}

.check-title {
  display: grid;
  gap: 8px;
  align-content: start;
}

.check-title strong {
  font-size: 16px;
}

.badge {
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.badge.ok {
  background: #d9f2e6;
  color: var(--ok);
}

.badge.missing {
  background: #fde7e7;
  color: var(--danger);
}

.badge.ng {
  background: #b91c1c;
  color: #fff;
}

.badge.partial {
  background: #fff2d9;
  color: var(--warn);
}

.check-content {
  color: #34444d;
  line-height: 1.8;
  white-space: pre-wrap;
}

.ng-text {
  color: var(--danger);
  font-weight: 800;
}

.reason-text {
  color: var(--danger);
  font-weight: 700;
}

.ok-text {
  color: #1d4ed8;
  font-weight: 800;
}

.output-box {
  padding: 18px;
}

pre {
  min-height: 220px;
  max-height: 520px;
  overflow: auto;
  margin: 16px 0 0;
  padding: 16px;
  background: #101820;
  color: #e7f0ef;
  border-radius: 6px;
  white-space: pre-wrap;
  line-height: 1.8;
}

.user-dialog {
  width: min(760px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.user-dialog::backdrop {
  background: rgba(16, 24, 32, 0.45);
}

.dialog-card {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.user-list {
  display: grid;
  gap: 10px;
}

.user-row,
.history-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.user-row div,
.history-row div {
  display: grid;
  gap: 4px;
}

.user-row span,
.history-row span,
.history-row small {
  color: var(--muted);
  font-size: 13px;
}

.history-list {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
}

.history-actions {
  display: flex !important;
  flex: 0 0 auto;
  gap: 8px;
}

.system-shell {
  width: min(100% - 20px, 1840px);
  max-width: 1800px;
  padding-top: 8px;
}

.station-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 10px;
  padding: 12px 14px;
  border-color: #d7e1e5;
  box-shadow: 0 12px 30px rgba(25, 38, 45, 0.05);
}

.station-brand {
  display: flex;
  gap: 14px;
  align-items: center;
  min-width: 0;
}

.station-brand #systemUser {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.system-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-left: auto;
}

.system-kpis div {
  display: grid;
  gap: 2px;
  width: 86px;
  height: 52px;
  padding: 7px 10px;
  background: #f3f7f8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.system-kpis span {
  color: var(--muted);
  font-size: 12px;
}

.system-kpis strong {
  font-size: 18px;
  line-height: 1.1;
}

.station-header #systemLogout {
  width: 118px;
  height: 52px;
  flex: 0 0 118px;
  border-radius: 8px;
  font-size: 15px;
}

.station-layout {
  display: grid;
  grid-template-columns: 186px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.station-content {
  min-width: 0;
  overflow: hidden;
}

.side-menu {
  position: sticky;
  top: 8px;
  display: grid;
  gap: 6px;
  width: 186px;
  min-width: 186px;
  align-self: start;
  max-height: none;
  overflow: visible;
  padding: 12px 10px;
  background: #fdfefe;
  border: 1px solid #d8e3e7;
  border-radius: 10px;
  box-shadow: 0 14px 34px rgba(25, 38, 45, 0.06);
}

.menu-group {
  display: grid;
  gap: 1px;
  padding: 0 0 8px;
  border-bottom: 1px solid #e7eef1;
}

.menu-group:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.menu-group h2 {
  margin: 4px 4px 5px;
  color: #77858e;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.learner-menu {
  display: none;
}

.tab-button {
  position: relative;
  min-height: 30px;
  height: auto;
  padding: 6px 10px 6px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  font-size: 12px;
  line-height: 1.25;
  text-align: left;
  box-shadow: none;
}

.tab-button:hover {
  background: #eef5f5;
  border-color: #e0eaed;
}

.tab-button.active {
  background: #e3f1ef;
  color: #0f5f59;
  border-color: #bfdad6;
  box-shadow: inset 3px 0 0 var(--accent);
}

.tab-panel {
  display: none !important;
}

.tab-panel.active {
  display: grid !important;
}

body[data-role="lms_user"] .manager-menu,
body[data-role="lms_user"] .glc-menu,
body[data-role="lms_user"] #tab-company,
body[data-role="lms_user"] #tab-users,
body[data-role="lms_user"] #tab-documents,
body[data-role="lms_user"] #tab-contract-check,
body[data-role="lms_user"] #tab-video-upload,
body[data-role="lms_user"] #tab-course-assign,
body[data-role="lms_user"] #tab-viewing,
body[data-role="lms_user"] #tab-analytics,
body[data-role="lms_user"] #tab-attendance,
body[data-role="lms_user"] #tab-customers,
body[data-role="lms_user"] #tab-applications,
body[data-role="lms_user"] #tab-chat,
body[data-role="lms_user"] #tab-notifications,
body[data-role="lms_user"] #tab-operation-history,
body[data-role="lms_user"] #tab-system-settings {
  display: none !important;
}

body[data-role="lms_user"] .learner-menu {
  display: grid;
}

body[data-role="company_admin"] .glc-menu {
  display: none;
}

.learner-panel.active {
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 14px;
}

.learner-list-panel,
.learner-player-panel {
  min-height: calc(100vh - 114px);
  align-content: start;
}

.learner-player-panel video {
  width: 100%;
  max-height: calc(100vh - 260px);
  background: #05080b;
  border-radius: 8px;
}

.course-item {
  cursor: pointer;
}

.course-item.locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.contract-frame {
  width: 100%;
  min-height: calc(100vh - 190px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

#tab-contracts {
  padding: 8px;
  gap: 8px;
}

#tab-contracts > .panel-head {
  display: none;
}

body.embedded-contract {
  background: #fff;
}

body.embedded-contract .login-screen {
  display: none !important;
}

body.embedded-contract .app-shell {
  width: 100%;
  padding: 0;
}

body.embedded-contract .topbar,
body.embedded-contract .hero {
  display: none;
}

body.embedded-contract .workspace {
  grid-template-columns: minmax(300px, 430px) minmax(0, 1fr);
  gap: 16px;
  margin-top: 0;
}

body.embedded-contract .input-panel {
  position: static;
  box-shadow: none;
}

body.embedded-contract .results {
  min-width: 0;
}

body.embedded-contract .summary-strip,
body.embedded-contract .wage-card,
body.embedded-contract .output-box,
body.embedded-contract .check-item {
  box-shadow: none;
}

.system-grid {
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: start;
}

#tab-notifications,
#tab-analytics,
#tab-viewing,
#tab-attendance,
#tab-applications,
#tab-chat,
#tab-customers,
#tab-users,
#tab-operation-history,
#tab-system-settings {
  grid-template-columns: 1fr;
}

#tab-video-upload,
#tab-course-assign,
#tab-contract-check {
  grid-template-columns: 1fr;
}

.panel-stack {
  display: grid;
  gap: 10px;
}

.settings-rail {
  position: static;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.system-card {
  display: grid;
  gap: 10px;
  padding: 13px;
  border-color: #d8e2e6;
  box-shadow: 0 14px 34px rgba(25, 38, 45, 0.055);
}

.wide-card {
  min-width: 0;
}

.registry-board {
  align-content: start;
  background:
    linear-gradient(180deg, #ffffff 0%, #ffffff 62%, #f8fbfb 100%);
}

.registry-board .panel-head {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

#tab-company .system-card h2 {
  margin: 0;
  font-size: 18px;
}

#tab-company .field {
  gap: 5px;
}

#tab-company input,
#tab-company select,
#tab-company textarea {
  min-height: 38px;
}

#tab-company .compact-textarea {
  min-height: 82px;
}

.compact-settings {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}

.compact-settings h3 {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 14px;
}

.compact-settings .grid-two {
  display: contents;
}

.compact-settings > .field {
  grid-column: span 2;
}

.compact-settings .toggle-row {
  min-height: 36px;
}

.settings-section {
  display: grid;
  gap: 10px;
  padding: 9px;
  background: #f8fbfb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.settings-section summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.settings-section summary:focus {
  outline: none;
}

.settings-section summary:focus-visible {
  outline: 2px solid rgba(15, 118, 110, 0.45);
  outline-offset: 3px;
  border-radius: 4px;
}

.settings-section[open] summary {
  margin-bottom: 8px;
}

.check-to-chat {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #f8fbfb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.chat-row strong {
  color: var(--accent-dark);
}

.compact-textarea {
  min-height: 130px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.toggle-row {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 30px;
  color: #2b3a42;
  font-size: 13px;
  font-weight: 800;
}

.toggle-row input {
  width: 18px;
  height: 18px;
}

.system-list {
  display: grid;
  gap: 6px;
  min-height: 42px;
}

.system-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #dfe7eb;
  border-radius: 6px;
}

.system-row > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.system-row span,
.system-row small {
  color: var(--muted);
  font-size: 12px;
}

.warning-row {
  border-left: 5px solid var(--warn);
}

.user-policy-list {
  display: grid;
  gap: 8px;
  min-width: 320px;
}

.mini-policy-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  background: #f8fbfb;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
}

.mini-policy-row label {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  white-space: nowrap;
}

.mini-policy-row input {
  width: 16px;
  height: 16px;
}

.assignment-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: center;
}

.assignment-row input,
.assignment-row select {
  min-width: 0;
}

.lms-console {
  min-width: 0;
}

.lms-layout {
  display: grid;
  grid-template-columns: minmax(300px, 360px) 1fr;
  gap: 12px;
  align-items: start;
}

.lms-upload-panel,
.lms-manage-panel {
  display: grid;
  gap: 14px;
}

.lms-upload-panel {
  padding: 12px;
  background: #f8fbfb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.lms-upload-panel h3,
.lms-board h3 {
  margin: 0;
  font-size: 16px;
}

.lms-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.analytics-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.analytics-kpis div {
  display: grid;
  gap: 4px;
  padding: 12px;
  background: #f3f7f8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.analytics-kpis span {
  color: var(--muted);
  font-size: 12px;
}

.analytics-kpis strong {
  font-size: 24px;
}

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

.mini-chart {
  display: grid;
  gap: 7px;
}

.mini-bar {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 28px;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.mini-bar strong {
  display: block;
  height: 10px;
  min-width: 4px;
  background: var(--accent);
  border-radius: 999px;
}

.mini-bar em {
  color: var(--ink);
  font-style: normal;
  text-align: right;
}

.lms-summary div {
  display: grid;
  gap: 6px;
  padding: 10px;
  background: #f3f7f8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.lms-summary span {
  color: var(--muted);
  font-size: 12px;
}

.lms-summary strong {
  font-size: 24px;
}

.lms-controls {
  display: grid;
  gap: 10px;
}

.lms-board {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: start;
}

.lms-board section {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.content-row,
.progress-row {
  align-items: stretch;
}

.content-meter {
  align-self: center;
  width: 120px;
  height: 8px;
  overflow: hidden;
  background: #e5ecef;
  border-radius: 999px;
}

.content-meter span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.lms-user-import {
  max-width: 520px;
}

.rule-list {
  display: grid;
  gap: 10px;
}

.rule-list span {
  padding: 10px 12px;
  background: #f3f7f8;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.viewer-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #101820;
  color: #eef7f6;
  border-radius: 8px;
}

.viewer-panel h3,
.viewer-panel strong {
  color: #fff;
}

.viewer-panel .field span,
.viewer-panel .panel-head span {
  color: #c9d8d7;
}

.viewer-panel video {
  width: 100%;
  max-height: 360px;
  background: #05080b;
  border-radius: 8px;
}

.viewer-panel .read-status {
  margin: 0;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: #cfe1df;
}

.viewer-panel .read-status.ok {
  background: rgba(4, 120, 87, 0.18);
  color: #b8f3d7;
}

.viewer-panel .read-status.error {
  background: rgba(185, 28, 28, 0.18);
  color: #fecaca;
}

.viewer-selects {
  grid-template-columns: 1fr 1fr 1fr;
}

.application-row pre {
  max-width: 100%;
  margin: 10px 0 0;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f8fbfb;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.notification-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-button {
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #2b3a42;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.chip-button.active {
  background: #102a3a;
  color: #fff;
  border-color: #102a3a;
}

.notification-center {
  min-height: calc(100vh - 128px);
  align-content: start;
}

#tab-notifications .warning-row {
  border-left-color: #0f766e;
}

#tab-chat {
  grid-template-columns: 1fr;
}

.chat-workspace {
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  align-items: stretch;
}

.chat-room-panel,
.chat-thread-panel {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 0;
}

.chat-room-panel {
  padding-right: 12px;
  border-right: 1px solid var(--line);
}

.chat-room-list {
  display: grid;
  gap: 7px;
}

.chat-room {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid #dfe7eb;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.chat-room.active,
.chat-room:hover {
  border-color: #0f766e;
  background: #e8f3f1;
}

.chat-room span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-room small {
  color: var(--muted);
  font-size: 11px;
}

.chat-room em {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: #dc2626;
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.chat-thread-panel {
  grid-template-rows: auto auto auto auto;
}

.chat-thread-head {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.chat-thread-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.chat-thread-head h2 {
  margin: 3px 0 0;
}

.chat-timeline {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 180px;
  max-height: 44vh;
  padding: 14px;
  overflow: auto;
  background: #f3f7f8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.chat-message {
  display: flex;
}

.chat-message.mine {
  justify-content: flex-end;
}

.chat-message.theirs {
  justify-content: flex-start;
}

.chat-bubble {
  display: grid;
  gap: 5px;
  max-width: min(70%, 640px);
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #dfe7eb;
  box-shadow: 0 8px 18px rgba(25, 38, 45, 0.045);
}

.chat-message.mine .chat-bubble {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}

.chat-message.alert .chat-bubble {
  border-left: 5px solid var(--warn);
}

.chat-bubble strong {
  font-size: 12px;
}

.chat-bubble strong span,
.chat-bubble small {
  color: inherit;
  opacity: 0.72;
}

.chat-bubble .read-receipt {
  justify-self: end;
  font-size: 11px;
  font-weight: 800;
}

.chat-bubble p {
  margin: 0;
  line-height: 1.65;
  white-space: pre-wrap;
}

.chat-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.chat-composer textarea {
  min-height: 54px;
  resize: vertical;
}

.empty-chat {
  display: grid;
  place-items: center;
  min-height: 120px;
  margin: 0;
  padding: 16px;
  background: #fff;
  border: 1px dashed #cbd8dd;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

.chat-guide-card {
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  align-items: center;
}

.compact-rule-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.customer-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 10px;
  align-items: start;
}

.customer-stage {
  display: grid;
  gap: 8px;
  min-height: 220px;
  padding: 10px;
  background: #f4f7f8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stage-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 7px 9px;
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.stage-head span {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

.stage-cards {
  display: grid;
  gap: 8px;
}

.stage-card {
  display: grid;
  gap: 6px;
  padding: 10px;
  background: #fff;
  border: 1px solid #dfe7eb;
  border-radius: 7px;
  box-shadow: 0 8px 18px rgba(25, 38, 45, 0.045);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.stage-card:hover {
  transform: translateY(-1px);
  border-color: #7aa8a3;
  box-shadow: 0 14px 24px rgba(25, 38, 45, 0.09);
}

.stage-card strong {
  font-size: 14px;
}

.stage-card span,
.stage-card small,
.stage-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.stage-card p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

.empty-stage {
  margin: 0;
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
}

.stage-1 .stage-head { background: #6b4b36; }
.stage-2 .stage-head { background: #8b3f4a; }
.stage-3 .stage-head { background: #7c4d88; }
.stage-4 .stage-head { background: #3e6f9f; }
.stage-5 .stage-head { background: #2d7a54; }
.stage-6 .stage-head { background: #8a6a2e; }
.stage-7 .stage-head { background: #9a5c31; }
.stage-8 .stage-head { background: #7c3f2d; }

.customer-detail-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 30;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(620px, 100vw);
  max-width: 100%;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 60px rgba(16, 24, 32, 0.22);
  transform: translateX(104%);
  transition: transform 0.22s ease;
}

.customer-detail-drawer.open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfb;
}

.drawer-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.drawer-head h2 {
  margin: 4px 0 0;
  font-size: 24px;
}

.drawer-body {
  display: grid;
  gap: 14px;
  align-content: start;
  padding: 18px 20px 28px;
  overflow: auto;
}

.drawer-section {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.drawer-section h3,
.drawer-mini-list h4 {
  margin: 0;
  font-size: 15px;
}

.drawer-related {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.drawer-related > div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f7f8;
}

.drawer-related span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.drawer-related strong {
  font-size: 22px;
}

.drawer-mini-list {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  padding-top: 4px;
}

.drawer-mini-list p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.dashboard-panel {
  align-content: start;
}

.dashboard-hero {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  background: linear-gradient(135deg, #ffffff, #edf7f5);
}

.dashboard-hero span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.dashboard-hero h2 {
  margin: 2px 0 4px;
  font-size: 24px;
}

.dashboard-hero p {
  margin: 0;
  color: var(--muted);
}

.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-kpi-grid article {
  display: grid;
  gap: 4px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(25, 38, 45, 0.045);
}

.dashboard-kpi-grid span,
.dashboard-kpi-grid small {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-kpi-grid strong {
  font-size: 28px;
}

.dashboard-main-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 1fr;
  gap: 10px;
}

#companyForm,
#userCreateForm,
#documentForm,
#customerForm,
#contentForm,
#attendanceForm,
#tab-attendance > .system-card:first-child,
#tab-applications > .system-card:first-child,
#tab-viewing > .system-card:first-child,
#tab-system-settings > .system-card:first-child,
#tab-operation-history > .system-card:first-child {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

#companyForm h2,
#userCreateForm h2,
#documentForm h2,
#customerForm h2,
#contentForm h3,
#tab-attendance > .system-card:first-child h2,
#tab-applications > .system-card:first-child h2,
#tab-viewing > .system-card:first-child .panel-head,
#tab-system-settings > .system-card:first-child h2,
#tab-operation-history > .system-card:first-child h2,
#companyForm .settings-section,
#userCreateForm .settings-section,
#customerForm .read-status,
#documentForm .read-status,
#companyForm .read-status,
#userCreateForm .read-status,
#contentForm .read-status,
#tab-attendance > .system-card:first-child .read-status,
#tab-applications > .system-card:first-child .read-status {
  grid-column: 1 / -1;
}

#companyForm .toggle-row {
  min-height: 38px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

#companyForm .grid-three {
  grid-column: 1 / -1;
}

#userCreateForm .grid-two,
#contentForm .grid-two {
  display: contents;
}

#customerForm textarea,
#contentForm textarea {
  min-height: 84px;
}

#customerForm .field:has(textarea),
#contentForm .field:has(textarea) {
  grid-column: span 2;
}

#contentForm {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

#contentForm .primary-button {
  min-height: 44px;
}

.lms-layout {
  grid-template-columns: 1fr;
}

.lms-user-import {
  max-width: none;
}

.rule-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.customer-board {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.user-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.user-form .full-button,
.user-form .read-status {
  grid-column: 1 / -1;
}

@media (max-width: 980px) {
  .app-shell {
    width: min(100% - 24px, 760px);
  }

  .hero,
  .workspace,
  .wage-card,
  .user-form,
  .system-hero,
  .system-grid,
  .station-layout,
  .customer-board,
  .analytics-layout,
  .lms-layout,
  .lms-board {
    grid-template-columns: 1fr;
  }

  .side-menu {
    position: static;
    max-height: none;
  }

  .input-panel {
    position: static;
  }

  .summary-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .hero,
  .input-panel,
  .wage-card,
  .output-box,
  .check-item {
    padding: 16px;
  }

  .grid-two,
  .grid-three,
  .check-item,
  .topbar,
  .topbar div,
  .topbar nav,
  .history-row,
  .history-actions,
  .system-kpis,
  .lms-summary,
  .assignment-row,
  .system-row,
  .mini-policy-row {
    grid-template-columns: 1fr;
    display: grid;
  }
}
