:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --line: #dbe3ee;
  --line-strong: #c9d4e3;
  --text: #142033;
  --muted: #667085;
  --nav-bg: #0f172a;
  --nav-hover: #1e293b;
  --nav-active: #24324a;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --dark-btn: #111827;
  --dark-btn-hover: #1f2937;
  --ok: #15803d;
  --warn: #b45309;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  --radius: 18px;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Malgun Gothic", sans-serif;
  font-size: 15px;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
}

a {
  color: inherit;
}

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

button {
  cursor: pointer;
  border: 0;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #8db2ff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
}

textarea {
  resize: vertical;
}

.app-shell {
  display: grid;
  grid-template-columns: 244px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, #0b1220 0%, #0f172a 100%);
  color: #f8fafc;
  padding: 26px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(255,255,255,0.05);
}

.brand {
  margin-bottom: 26px;
  padding: 6px 6px 14px 6px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-sub {
  margin-top: 6px;
  color: #94a3b8;
  font-size: 0.92rem;
}

.sidebar nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar nav li + li {
  margin-top: 8px;
}

.sidebar a {
  display: block;
  padding: 12px 14px;
  border-radius: 12px;
  text-decoration: none;
  color: #e2e8f0;
  font-weight: 600;
  transition: background .15s ease, color .15s ease;
}

.sidebar a:hover {
  background: var(--nav-hover);
}

.sidebar a.active {
  background: var(--nav-active);
  color: #fff;
}

.content {
  padding: 30px 34px;
}

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

.page-header h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.page-desc {
  margin: 8px 0 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.page-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stat-chip {
  min-width: 110px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.stat-chip strong {
  font-size: 1.2rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.hero-card {
  padding: 18px 20px 14px 20px;
}

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
}

.field-block {
  min-width: 160px;
}

.field-block label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 700;
}

.field-date {
  min-width: 180px;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  height: 42px;
  padding: 0 14px;
  border-radius: 11px;
  background: #eef2f7;
  color: var(--text);
  font-weight: 700;
  border: 1px solid var(--line);
}

.btn:hover {
  background: #e6ebf3;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

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

.btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

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

.btn-dark {
  background: var(--dark-btn);
  color: #fff;
  border-color: var(--dark-btn);
}

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

.btn-full {
  width: 100%;
}

.sub-guide {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.bulk-card {
  padding-top: 16px;
  padding-bottom: 16px;
}

.bulk-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
}

.bulk-action {
  display: flex;
  flex-direction: column;
  justify-content: end;
}

.table-card {
  padding: 0;
  overflow: hidden;
}

.table-wrap {
  overflow: auto;
  max-height: 68vh;
}

.work-table {
  width: 100%;
  min-width: 1280px;
  border-collapse: separate;
  border-spacing: 0;
}

.work-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eff4fb;
  color: #334155;
  border-bottom: 1px solid var(--line-strong);
  padding: 14px 10px;
  text-align: center;
  font-size: 0.88rem;
  white-space: nowrap;
}

.work-table tbody td {
  border-bottom: 1px solid #edf2f7;
  padding: 8px;
  background: #fff;
  vertical-align: middle;
}

.work-table tbody tr:hover td {
  background: #f8fbff;
}

.row-selected td {
  background: #eef5ff !important;
}

.work-table input,
.work-table textarea,
.work-table select {
  width: 100%;
  min-width: unset;
  padding: 9px 10px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
}

.work-table textarea {
  min-height: 42px;
}

.w-check { width: 66px; }
.w-seq { width: 70px; }
.w-part { width: 180px; }
.w-lot { width: 170px; }
.w-rpu { width: 130px; }
.w-qty { width: 120px; }
.w-final { width: 170px; }
.w-worker { width: 150px; }
.w-eq { width: 120px; }
.w-kms { width: 80px; }
.w-remark { width: 220px; }

.num {
  text-align: right;
}

.center {
  text-align: center;
}

.final-cell {
  font-weight: 800;
  color: #0f172a;
  background: #f8fbff;
}

.preview-card {
  padding: 18px 20px 20px 20px;
}

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

.status-line {
  margin-top: 6px;
  font-weight: 800;
}

.status-ok {
  color: var(--ok);
}

.status-warn {
  color: var(--warn);
}

.preview-count {
  color: var(--muted);
  font-weight: 700;
}

.preview-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.preview-box {
  width: 100%;
  min-height: 180px;
  background: #0f172a;
  color: #e2e8f0;
  border: 0;
  border-radius: 14px;
  padding: 16px;
  line-height: 1.6;
}

h1 {
  margin-top: 0;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

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

.grid-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.grid-table th,
.grid-table td {
  border-bottom: 1px solid #edf2f7;
  padding: 10px 8px;
  vertical-align: middle;
}

.grid-table th {
  background: #eff4fb;
  position: sticky;
  top: 0;
  z-index: 1;
}

@media (max-width: 1400px) {
  .page-header {
    flex-direction: column;
  }

  .page-badges {
    width: 100%;
  }
}

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

  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
  }

  .content {
    padding: 20px 16px;
  }

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