:root {
  --bg: #eef3f7;
  --surface: #ffffff;
  --surface-soft: #f7fafc;
  --surface-strong: #edf3f8;
  --ink: #172033;
  --muted: #6a7890;
  --border: #d7e1ec;
  --nav: #14213d;
  --nav-soft: #1f2d4d;
  --gold: #c9963e;
  --blue: #2f6fad;
  --teal: #13806f;
  --green: #20845a;
  --amber: #b56b16;
  --red: #b42318;
  --shadow: 0 18px 42px rgba(20, 33, 61, 0.1);
  --shadow-soft: 0 8px 22px rgba(20, 33, 61, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: linear-gradient(180deg, #e8edf4 0%, #f8fafc 44%, #eef3f7 100%);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

body.login-locked {
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% 18%, rgba(19, 128, 111, 0.18), transparent 28%),
    radial-gradient(circle at 82% 22%, rgba(47, 111, 173, 0.14), transparent 30%),
    linear-gradient(135deg, #3d4853 0%, #6f7b86 100%);
}

body.login-locked .app-shell {
  display: none;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

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

.login-card {
  width: min(460px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 28px 26px;
  background: #111a21;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.28);
}

.login-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.login-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid #30c8c1;
  border-radius: 8px;
  background: #0d7f86;
  color: #ffffff;
  font-size: 25px;
  font-weight: 900;
}

.login-card h1 {
  color: #ffffff;
  font-size: 28px;
}

.login-card p {
  margin-top: 8px;
  color: #9aa8b8;
}

.login-card label {
  margin-top: 14px;
  color: #dce5ef;
  font-weight: 800;
}

.login-card input,
.login-card select {
  min-height: 42px;
  border-color: transparent;
  background: #ffffff;
}

.login-language {
  margin-bottom: 4px;
}

.login-message {
  min-height: 22px;
  margin-top: 12px;
  color: #9ee4d4;
  font-size: 13px;
  font-weight: 800;
}

.login-message.error {
  color: #ffb4a8;
}

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

.login-actions.compact {
  margin-top: 8px;
}

.password-recovery {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.password-recovery[hidden] {
  display: none;
}

.login-divider {
  color: #ffffff;
  font-size: 15px;
  font-weight: 900;
}

.login-card .primary-button {
  min-width: 110px;
}

.login-card .ghost-button {
  background: #ffffff;
  color: #111a21;
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: min(1520px, calc(100% - 32px));
  margin: 18px auto 44px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border: 1px solid #263755;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0)), var(--nav);
  box-shadow: var(--shadow);
}

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

.brand-mark {
  display: grid;
  flex: 0 0 50px;
  width: 50px;
  height: 50px;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  background: linear-gradient(135deg, #d9aa55 0%, #b98226 100%);
  color: #fff;
  font-size: 25px;
  font-weight: 900;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  color: #fff;
  font-size: 25px;
  line-height: 1.2;
}

h2 {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.3;
}

h3 {
  color: var(--ink);
  font-size: 17px;
}

.brand p {
  margin-top: 6px;
  color: #b8c3d4;
  font-size: 13px;
}

.top-actions,
.form-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.auth-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.auth-bar input {
  width: 112px;
  min-height: 38px;
  border-color: #374967;
}

.auth-bar span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid #374967;
  border-radius: 8px;
  padding: 0 10px;
  background: rgba(255,255,255,0.07);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.notification-area {
  position: relative;
}

.notification-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid #374967;
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--nav-soft);
  color: #fff;
  font-weight: 900;
}

.notification-button strong {
  display: grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: #64748b;
  color: #fff;
  font-size: 12px;
}

.notification-button.has-alerts strong {
  background: var(--red);
}

.notification-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 10px);
  right: 0;
  width: min(390px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  box-shadow: var(--shadow);
}

.notification-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.notification-head strong {
  color: var(--ink);
}

.notification-head small {
  color: var(--muted);
  font-weight: 800;
}

.notification-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding-top: 10px;
}

.notification-item {
  display: grid;
  width: 100%;
  gap: 4px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  padding: 10px;
  background: #fffaf0;
  text-align: left;
}

.notification-item.danger {
  border-left-color: var(--red);
  background: #fff5f5;
}

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

.notification-item strong {
  color: var(--ink);
  font-size: 13px;
}

.notification-item small,
.notification-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.notification-empty {
  padding: 12px;
  text-align: center;
}

.primary-button,
.ghost-button,
.mini-action {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 800;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.primary-button {
  background: var(--teal);
  color: #fff;
}

.primary-button:hover,
.ghost-button:hover,
.mini-action:hover {
  transform: translateY(-1px);
}

.ghost-button,
.mini-action {
  border-color: var(--border);
  background: var(--surface);
  color: var(--ink);
}

.topbar .ghost-button {
  border-color: #374967;
  background: var(--nav-soft);
  color: #fff;
}

.mini-action {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

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

.mini-action.success {
  color: var(--green);
}

.mini-action.solid {
  border-color: transparent;
  color: #fff;
}

.mini-action.danger.solid {
  background: var(--red);
}

.mini-action.success.solid {
  background: var(--green);
}

.link-action {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 0;
  font: inherit;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}

.readonly-price {
  background: #f4f7fb;
  color: var(--muted);
  cursor: not-allowed;
}

.view-tabs {
  display: flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  max-width: 100%;
  margin: 14px 0;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,0.9);
  box-shadow: var(--shadow-soft);
  overflow: auto;
}

.view-tabs button {
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 9px 14px;
  font-weight: 800;
  white-space: nowrap;
}

.view-tabs button.active {
  background: #edf3f8;
  color: var(--nav);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.panel,
.kpi-card,
.process-card,
.employee-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.panel {
  min-width: 0;
  padding: 20px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(280px, 1.2fr) minmax(190px, 0.45fr) minmax(170px, 0.4fr);
  gap: 14px;
  align-items: end;
  margin-bottom: 16px;
}

.log-filters {
  grid-template-columns: minmax(280px, 1fr);
  margin-top: 18px;
}

label {
  display: grid;
  gap: 7px;
}

label span,
.field-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

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

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(19, 128, 111, 0.14);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.kpi-card {
  min-height: 118px;
  padding: 20px;
  border-top: 3px solid var(--gold);
}

.kpi-card:nth-child(2) {
  border-top-color: var(--green);
}

.kpi-card:nth-child(3) {
  border-top-color: var(--amber);
}

.kpi-card:nth-child(4) {
  border-top-color: var(--red);
}

.kpi-card:nth-child(5) {
  border-top-color: var(--blue);
}

.kpi-card span,
.kpi-card small,
.section-title p,
.detail-hero p,
.meta-text,
.muted-label {
  color: var(--muted);
}

.error-text {
  color: var(--red);
  font-weight: 900;
}

.kpi-card span {
  font-size: 13px;
  font-weight: 900;
}

.kpi-card strong {
  display: block;
  margin-top: 14px;
  font-size: 30px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.kpi-card small {
  display: block;
  margin-top: 10px;
}

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

.system-card {
  display: grid;
  gap: 8px;
  min-height: 118px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 18px;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.system-card:hover {
  border-color: #9bb7d3;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
}

.system-card strong {
  font-size: 18px;
}

.system-card span {
  color: var(--muted);
  font-weight: 700;
}

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

.section-title p {
  margin-top: 6px;
  font-size: 12px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.order-table,
.task-table {
  width: 100%;
  border-collapse: collapse;
}

.order-table {
  min-width: 1500px;
  table-layout: fixed;
}

.task-table {
  min-width: 980px;
}

.order-table th,
.order-table td,
.task-table th,
.task-table td {
  border-bottom: 1px solid var(--border);
  padding: 13px 12px;
  text-align: left;
  vertical-align: middle;
}

.order-table th,
.task-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f2f5f9;
  color: #39455a;
  font-size: 12px;
  font-weight: 900;
}

.order-table tbody tr:hover,
.task-table tbody tr:hover {
  background: #f7fbfb;
}

.order-table th:nth-child(1),
.order-table td:nth-child(1) {
  width: 78px;
  text-align: center;
}

.order-table th:nth-child(9),
.order-table td:nth-child(9),
.order-table th:nth-child(10),
.order-table td:nth-child(10),
.order-table th:nth-child(13),
.order-table td:nth-child(13) {
  width: 178px;
}

.order-table th:nth-child(14),
.order-table td:nth-child(14) {
  width: 190px;
}

.progress-button {
  position: relative;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.progress-cell {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border: 1px solid #d6e0ea;
  border-radius: 999px;
  background: #eef3f8;
}

.progress-fill {
  display: block;
  height: 100%;
  min-width: 3px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), #49a4df);
}

.progress-fill.combo {
  background: linear-gradient(90deg, var(--gold), var(--teal));
}

.progress-fill.alert {
  background: linear-gradient(90deg, var(--amber), var(--red));
}

.progress-fill.done {
  background: linear-gradient(90deg, var(--green), #49ad77);
}

.progress-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 30;
  display: grid;
  gap: 6px;
  width: 220px;
  max-width: 70vw;
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
  color: var(--ink);
  transform: translate(-50%, 6px);
  opacity: 0;
  pointer-events: none;
  transition: 0.16s ease;
}

.progress-tooltip span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.progress-tooltip i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #cbd5e1;
}

.progress-tooltip span.done {
  color: var(--green);
}

.progress-tooltip span.done i {
  background: var(--green);
}

.progress-button:hover .progress-tooltip,
.progress-button:focus-visible .progress-tooltip {
  transform: translate(-50%, 0);
  opacity: 1;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.badge.active {
  background: #edf5ff;
  color: var(--blue);
}

.badge.done {
  background: #edf8f1;
  color: var(--green);
}

.badge.warn {
  background: #fff5e5;
  color: var(--amber);
}

.badge.danger {
  background: #fff0ee;
  color: var(--red);
}

.row-actions {
  justify-content: flex-start;
  margin-top: 10px;
}

.detail-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(280px, 0.35fr);
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #ffffff 0%, #f3f7fb 100%);
}

.detail-hero h2 {
  font-size: 24px;
}

.process-stack {
  display: grid;
  gap: 18px;
}

.process-card {
  overflow: hidden;
}

.process-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-strong);
}

.process-card-header small {
  color: var(--muted);
}

.process-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding: 20px;
}

.process-field {
  display: grid;
  gap: 7px;
}

.process-field.wide {
  grid-column: span 2;
}

.process-field.full {
  grid-column: 1 / -1;
}

.employee-picker {
  display: grid;
  gap: 10px;
  min-height: 42px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.employee-picker-search {
  min-height: 36px;
}

.employee-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 8px;
  max-height: 232px;
  overflow: auto;
  padding-right: 4px;
}

.employee-choice-card {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 54px;
  border: 1px solid #c9d8e7;
  border-radius: 8px;
  padding: 7px;
  background: #f7fafc;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.employee-choice-card:has(input:checked) {
  border-color: var(--teal);
  background: #edf8f5;
  box-shadow: inset 0 0 0 1px rgba(19, 128, 111, 0.16);
}

.employee-choice-card input {
  position: absolute;
  top: 7px;
  right: 7px;
  width: auto;
}

.employee-choice-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding-right: 18px;
}

.employee-choice-copy strong,
.employee-choice-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-choice-copy small {
  color: var(--muted);
  font-weight: 700;
}

.employee-empty {
  color: var(--muted);
  font-size: 13px;
}

.avatar,
.avatar-editor {
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #c9d8e7;
  border-radius: 8px;
  background: linear-gradient(135deg, #edf3f8, #ffffff);
  color: var(--nav);
  font-weight: 900;
}

.avatar {
  width: 38px;
  height: 38px;
  font-size: 13px;
}

.avatar img,
.avatar-editor img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.completion-field {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  min-height: 38px;
  border: 1px solid #c9d8e7;
  border-radius: 999px;
  padding: 7px 12px;
  background: #fff;
  font-weight: 900;
}

.completion-field input {
  width: auto;
}

.process-save-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.task-filter-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 220px)) auto;
  gap: 12px;
  align-items: end;
  justify-content: start;
  margin-bottom: 14px;
}

.employee-task-wrap {
  overflow: visible;
}

.employee-task-wrap .task-table {
  min-width: 0;
  table-layout: fixed;
}

.employee-task-wrap .task-table th,
.employee-task-wrap .task-table td {
  white-space: normal;
  word-break: break-word;
}

.employee-task-wrap .task-table th:nth-child(1),
.employee-task-wrap .task-table td:nth-child(1) {
  width: 185px;
}

.employee-task-wrap .task-table th:nth-child(2),
.employee-task-wrap .task-table td:nth-child(2) {
  width: 140px;
}

.employee-task-wrap .task-table th:nth-child(3),
.employee-task-wrap .task-table td:nth-child(3) {
  width: auto;
}

.employee-task-wrap .task-table th:nth-child(4),
.employee-task-wrap .task-table td:nth-child(4),
.employee-task-wrap .task-table th:nth-child(5),
.employee-task-wrap .task-table td:nth-child(5) {
  width: 150px;
}

.employee-task-wrap .task-table th:nth-child(6),
.employee-task-wrap .task-table td:nth-child(6),
.employee-task-wrap .task-table th:nth-child(7),
.employee-task-wrap .task-table td:nth-child(7) {
  width: 105px;
}

.employee-group-row {
  background: #fbfdff;
}

.employee-group-row td {
  padding-top: 20px;
  padding-bottom: 20px;
  font-size: 14px;
}

.employee-group-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.employee-group-name strong {
  display: block;
}

.employee-expand-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
  border: 0;
  background: transparent;
  color: var(--teal);
  padding: 0;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.employee-day-row td {
  background: #f7fafc;
  border-top: 0;
  padding-top: 16px;
  padding-bottom: 16px;
}

.employee-day-list {
  display: grid;
  gap: 8px;
}

.employee-day-list div {
  display: grid;
  gap: 3px;
  border-left: 3px solid #c9d8e7;
  padding: 8px 10px;
  background: #fff;
  border-radius: 8px;
}

.employee-day-list small {
  color: var(--muted);
}

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

.full-field {
  grid-column: 1 / -1;
}

.section-divider {
  display: grid;
  place-items: center;
  min-height: 40px;
  margin: 18px 0 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--nav);
  font-weight: 900;
}

.form-actions {
  margin-top: 18px;
}

.employee-layout {
  display: grid;
  grid-template-columns: minmax(360px, 430px) minmax(560px, 1fr);
  gap: 18px;
  align-items: start;
}

#employeeEditorPanel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(330px, 420px) minmax(460px, 1fr);
  gap: 18px 22px;
  align-items: start;
}

#employeeEditorPanel .section-title {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

#employeeEditorPanel #employeeForm {
  min-width: 0;
}

.employee-directory-panel {
  align-self: stretch;
  min-width: 0;
  min-height: 560px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
}

.compact-title {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.compact-title h3 {
  margin: 0;
  color: var(--nav);
  font-size: 18px;
}

.compact-title p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.employee-layout > .panel:nth-child(2) {
  grid-column: 1 / -1;
  min-width: 0;
}

#employeesView .panel {
  min-width: 0;
}

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

.employee-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 0;
  max-height: 620px;
  min-height: 0;
  overflow: auto;
  align-content: start;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fbfe;
}

.employee-list .empty-state {
  grid-column: 1 / -1;
  min-height: 180px;
}

html[dir="rtl"] body {
  font-family: "Segoe UI", Arial, sans-serif;
}

html[dir="rtl"] .brand,
html[dir="rtl"] .login-head,
html[dir="rtl"] .top-actions,
html[dir="rtl"] .form-actions,
html[dir="rtl"] .row-actions,
html[dir="rtl"] .progress-row,
html[dir="rtl"] .process-card-header {
  direction: rtl;
}

html[dir="rtl"] .progress-button {
  text-align: right;
}

.employee-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  box-shadow: none;
}

.employee-card-head {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 12px;
}

.employee-card strong {
  font-size: 16px;
}

.employee-card small {
  color: var(--muted);
}

.employee-profile-editor {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  cursor: pointer;
}

.employee-profile-editor:hover {
  border-color: #9bb7d3;
  background: #f8fbfe;
}

.employee-profile-editor p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.avatar-editor {
  width: 76px;
  height: 76px;
  padding: 0;
  font-size: 24px;
}

.employee-meta-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.employee-meta-grid span {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.attendance-panel {
  grid-column: 1 / -1;
}

.salary-panel {
  grid-column: 1 / -1;
}

.salary-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}

.salary-toolbar label {
  width: min(220px, 100%);
}

.payroll-edit-panel {
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  background: linear-gradient(180deg, #fbfdff, #f6fafc);
}

.payroll-edit-panel .compact-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.payroll-edit-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.payroll-edit-table {
  min-width: 1180px;
}

.payroll-edit-table th:nth-child(1),
.payroll-edit-table td:nth-child(1) {
  width: 170px;
}

.payroll-edit-table th:nth-child(9),
.payroll-edit-table td:nth-child(9) {
  width: 220px;
}

.payroll-employee-cell {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 900;
  color: var(--nav);
}

.payroll-input {
  width: 100%;
  min-width: 92px;
  height: 36px;
  border: 1px solid #cfdcea;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.payroll-input:focus {
  border-color: var(--green);
  outline: 3px solid rgba(13, 132, 111, 0.12);
}

.payroll-note-input {
  min-width: 190px;
}

.payroll-total {
  color: var(--green);
  font-size: 15px;
  font-weight: 900;
}

.payroll-row-highlight td {
  background: #eefaf5;
  box-shadow: inset 0 0 0 1px rgba(13, 132, 111, 0.2);
}

.quota-panel {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface-soft);
}

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

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

.attendance-grid article {
  min-height: 96px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface-soft);
}

.attendance-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.attendance-grid strong {
  display: block;
  margin-top: 12px;
  font-size: 28px;
}

.inventory-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.36fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.inventory-search-field {
  margin-bottom: 14px;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.46fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

#usersView .admin-layout {
  grid-template-columns: minmax(0, 1fr);
}

#userEditorPanel {
  border-color: #b7cadf;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

#userEditorPanel[hidden] {
  display: none;
}

#usersView .panel:nth-child(2) {
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}

.permission-grid {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.permission-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-soft);
}

.permission-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.permission-row input {
  width: auto;
}

.inventory-card-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.inventory-category-section {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}

.inventory-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.inventory-category-head strong {
  color: var(--nav);
  font-size: 16px;
}

.inventory-category-head span:not(.badge) {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.inventory-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
}

.inventory-card {
  display: grid;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px;
  background: var(--surface-soft);
  text-align: left;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.inventory-card:hover,
.inventory-card.selected {
  transform: translateY(-1px);
  border-color: var(--teal);
  box-shadow: 0 10px 22px rgba(14, 30, 55, 0.12);
}

.inventory-card.warn {
  border-color: rgba(245, 158, 11, 0.45);
  background: #fff8ea;
}

.inventory-card.danger {
  border-color: rgba(239, 68, 68, 0.45);
  background: #fff1f1;
}

.inventory-card.high {
  border-color: rgba(37, 99, 235, 0.35);
  background: #eff6ff;
}

.inventory-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.inventory-card strong {
  display: block;
  font-size: 13px;
  line-height: 1.2;
}

.inventory-card small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.inventory-card .badge {
  padding: 3px 7px;
  font-size: 11px;
}

.inventory-card-main {
  display: grid;
  gap: 2px;
}

.inventory-card-main span {
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.inventory-meter {
  display: grid;
  gap: 4px;
}

.inventory-meter-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf5;
}

.inventory-meter-fill {
  display: block;
  height: 100%;
  min-width: 4px;
  border-radius: inherit;
  background: var(--green);
}

.inventory-meter-fill.warn {
  background: var(--amber);
}

.inventory-meter-fill.danger {
  background: var(--red);
}

.inventory-meter-fill.high {
  background: var(--blue);
}

.inventory-card-hint {
  color: var(--teal) !important;
}

.employee-detail-panel,
.inventory-detail-panel {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.cost-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.entry-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.36fr);
  gap: 18px;
  align-items: start;
}

.ocr-entry-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 340px) auto minmax(180px, auto);
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
  border: 1px solid #c9d8e7;
  border-radius: 8px;
  padding: 14px;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}

.ocr-entry-panel strong {
  display: block;
  color: var(--nav);
  font-size: 16px;
}

.ocr-entry-panel span {
  color: var(--muted);
  font-weight: 700;
}

.ocr-file-field {
  margin: 0;
}

.entry-recorder {
  margin: 12px 0 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.entry-recorder strong {
  color: var(--teal);
}

.detail-entry-grid {
  align-items: end;
}

.highlight-entry-field {
  transform: translateX(18px);
}

.highlight-entry-field span {
  color: var(--teal);
  font-size: 13px;
}

.highlight-entry-field input {
  border-color: #8fb9cc;
  background: #f0fbf8;
  color: #0f766e;
  font-weight: 900;
}

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

.size-pair-field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.size-pair-control {
  display: grid;
  grid-template-columns: 54px minmax(76px, 1fr) 34px 22px 54px minmax(76px, 1fr) 34px;
  align-items: stretch;
  overflow: hidden;
  min-height: 42px;
  border: 1px solid #8fb9cc;
  border-radius: 8px;
  background: #f0fbf8;
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.08);
}

.size-pair-control label {
  display: contents;
}

.size-pair-control label span,
.size-pair-control .size-unit,
.size-pair-control .size-times {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 0 6px;
  border-right: 1px solid rgba(15, 118, 110, 0.24);
  color: #12304a;
  font-size: 13px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.66);
}

.size-pair-control .size-unit {
  color: #475569;
  font-weight: 700;
}

.size-pair-control .size-times {
  color: var(--teal);
  font-size: 17px;
  font-weight: 900;
}

.size-pair-control .size-unit:last-child {
  border-right: 0;
}

.size-pair-control input {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 0;
  background: #f0fbf8;
  color: #0f766e;
  font-weight: 900;
  box-shadow: none;
}

.size-pair-control input:focus {
  outline: 2px solid rgba(15, 118, 110, 0.24);
  outline-offset: -2px;
}

.meter-field input {
  color: #0f766e;
  font-weight: 900;
  background: #fbfefd;
}

.meter-calc-row {
  display: grid;
  grid-template-columns: 120px minmax(240px, 360px) minmax(240px, 360px);
  align-items: end;
  justify-content: center;
  gap: 28px;
  width: min(920px, 100%);
  margin: 6px auto 0;
}

.meter-calc-row .meter-field {
  display: grid;
  gap: 8px;
}

.calculate-meter-button {
  min-height: 42px;
  border-color: rgba(15, 118, 110, 0.35);
  color: var(--teal);
  font-weight: 900;
  background: #f1fbf8;
}

.calculate-meter-button:hover {
  background: #e1f5ef;
  border-color: var(--teal);
}

.quick-template-panel {
  display: grid;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}

.quick-template-panel .section-title {
  margin-bottom: 0;
}

.quick-template-form {
  display: grid;
  gap: 12px;
}

.compact-actions {
  margin-top: 0;
}

.low-stock {
  color: var(--red);
  font-weight: 900;
}

.quota-grid label span {
  color: var(--nav);
  font-size: 13px;
  font-weight: 900;
}

.money-text {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.task-status {
  white-space: nowrap;
}

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-soft);
}

.security-notice {
  flex: 1 1 100%;
  min-width: 240px;
  border: 1px solid rgba(245, 158, 11, 0.32);
  border-radius: 8px;
  padding: 8px 10px;
  color: #92400e;
  background: #fff7ed;
  font-size: 13px;
  font-weight: 800;
}

.security-lock {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.54);
  backdrop-filter: blur(8px);
}

.security-lock[hidden] {
  display: none;
}

.security-lock-card {
  width: min(440px, 100%);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  padding: 22px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.security-lock-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
  margin-bottom: 18px;
}

.security-lock-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: var(--nav);
  font-size: 15px;
  font-weight: 900;
}

.security-lock h2 {
  margin: 0 0 6px;
  font-size: 20px;
  color: var(--ink);
}

.security-lock p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.security-lock-form {
  display: grid;
  gap: 14px;
}

.security-lock-form label {
  display: grid;
  gap: 8px;
  color: var(--nav);
  font-size: 13px;
  font-weight: 900;
}

.security-lock-message {
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.security-lock-message.error {
  color: var(--red);
}

.security-lock-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

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

@media (max-width: 1100px) {
  .filters,
  .kpi-grid,
  .form-grid,
  .process-grid,
  .ocr-entry-panel,
  .employee-layout,
  .inventory-layout,
  .admin-layout,
  .entry-content,
  .system-card-grid,
  .cost-grid,
  .quota-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .employee-layout {
    align-items: stretch;
  }

  #employeeEditorPanel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 18px, 1520px);
    margin-top: 9px;
  }

  .topbar,
  .section-title,
  .detail-hero,
  .process-card-header {
    align-items: flex-start;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .top-actions,
  .view-tabs {
    width: 100%;
  }

  .top-actions button {
    flex: 1 1 auto;
  }

  .filters,
  .kpi-grid,
  .form-grid,
  .process-grid,
  .ocr-entry-panel,
  .employee-layout,
  .inventory-layout,
  .admin-layout,
  .entry-content,
  .system-card-grid,
  .cost-grid,
  .quota-grid {
    grid-template-columns: 1fr;
  }

  .process-field.wide {
    grid-column: span 1;
  }

  .brand {
    align-items: flex-start;
  }

  .login-screen {
    align-items: start;
    padding: 14px;
  }

  .login-card {
    width: 100%;
    padding: 22px 18px;
  }

  .login-card h1 {
    font-size: 22px;
  }

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

  .login-actions button,
  .top-actions button,
  .form-actions button {
    width: 100%;
    min-height: 44px;
  }

  input,
  select,
  textarea {
    min-height: 44px;
  }

  .panel {
    padding: 16px;
  }

  .view-tabs {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .view-tabs button {
    flex: 0 0 auto;
    min-height: 42px;
  }

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

  .task-filter-bar {
    grid-template-columns: 1fr;
  }

  #employeeEditorPanel {
    grid-template-columns: 1fr;
  }

  .employee-list {
    max-height: none;
    min-height: 220px;
    padding: 10px;
  }

  .employee-directory-panel {
    min-height: 0;
  }

  .highlight-entry-field {
    transform: none;
  }

  .meter-calc-row {
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
  }

  .size-pair-control {
    grid-template-columns: 44px minmax(54px, 1fr) 28px 18px 44px minmax(54px, 1fr) 28px;
  }

  .size-pair-control label span,
  .size-pair-control .size-unit,
  .size-pair-control .size-times {
    padding: 0 4px;
    font-size: 12px;
  }
}
