:root {
  --bg:#eef2f7;
  --card:#ffffff;
  --border:#e3e9f2;
  --text:#1f2937;
  --muted:#64748b;
  --primary:#0b3a67;
  --primary-soft:rgba(11,58,103,0.14);
  --success:#15803d;
  --success-soft:#dcfce7;
  --danger:#b91c1c;
  --danger-soft:#fee2e2;
  --radius-lg:18px;
  --radius-md:12px;
  --shadow:0 18px 40px rgba(15,23,42,0.1), 0 6px 16px rgba(15,23,42,0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Plus Jakarta Sans", "Noto Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 90% -10%, rgba(11,58,103,0.14), transparent 60%),
    radial-gradient(900px 520px at 0% 0%, rgba(15,23,42,0.08), transparent 55%),
    linear-gradient(180deg, #eef2f7 0%, #f7f8fb 100%);
}

.app-shell {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: 250px;
  padding: 22px 18px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, #eef2f7 0%, #7c97b6 58%, #1b4f7a 100%);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sidebar-logo {
  width: 160px;
  max-width: 100%;
  display: block;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-item {
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 12px;
  color: #e2ebf6;
  background: rgba(15, 23, 42, 0.22);
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
}

.menu-item.is-active {
  background: #fff;
  color: var(--primary);
  border-color: #fff;
}

.content {
  flex: 1;
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.page-header {
  padding: 20px 24px;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 32px);
  color: #0f172a;
}

.page-header p {
  margin: 8px 0 0;
  color: var(--muted);
}

.upload-card {
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: end;
}

.upload-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 300px;
}

.pdf-controls {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}

.field-inline {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 120px;
}

.file-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

input[type="file"] {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: #f8fafc;
}

select {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: #f8fafc;
  font-family: inherit;
  color: #0f172a;
}

.upload-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn {
  height: 40px;
  border-radius: 12px;
  border: 1px solid transparent;
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #0b3a67 0%, #124c89 55%, #1c63b0 100%);
  color: #fff;
}

.btn-ghost {
  background: #f8fafc;
  color: #1e293b;
  border-color: var(--border);
}

.summary-card {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}

.metric span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.metric strong {
  font-size: 20px;
  color: #0f172a;
}

.status {
  font-size: 14px;
  color: #0f172a;
  border-radius: 12px;
  padding: 10px 14px;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
}

.status.error {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #fecaca;
}

.status.success {
  color: #166534;
  background: var(--success-soft);
  border-color: #bbf7d0;
}

.schedule-grid {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 4px 2px 16px;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 240px;
}

.day-card {
  border: 1px solid #c7d6e7;
  border-radius: 14px;
  background: linear-gradient(180deg, #eef4fb 0%, #f7fbff 100%);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
  overflow: hidden;
  flex: 0 0 clamp(290px, 26vw, 360px);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 280px);
}

.day-head {
  padding: 12px 12px 9px;
  border-bottom: 1px solid #c7d6e7;
  background: linear-gradient(180deg, #dce9f7 0%, #eef5fd 100%);
  position: sticky;
  top: 0;
  z-index: 1;
}

.day-title {
  margin: 0;
  color: #0f172a;
  font-size: 16px;
}

.day-meta {
  margin-top: 6px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  font-size: 12px;
  border-radius: 999px;
  padding: 4px 8px;
  font-weight: 600;
}

.tag.blue {
  background: var(--primary-soft);
  color: var(--primary);
}

.tag.green {
  background: var(--success-soft);
  color: var(--success);
}

.day-body {
  padding: 8px 10px 12px;
  overflow: auto;
}

.piece-row {
  border: 1px solid #d9e4ef;
  border-radius: 10px;
  padding: 9px;
  margin-top: 8px;
  background: #ffffff;
  box-shadow: 0 5px 12px rgba(15, 23, 42, 0.08);
}

.piece-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.piece-name {
  font-weight: 700;
  color: #0f172a;
  font-size: 14px;
  line-height: 1.3;
  word-break: break-word;
}

.piece-vol {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  margin-left: 8px;
}

.checkbox-list {
  margin-top: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.check-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 1px solid #cbd5e1;
  background: #fff;
}

.check-item input {
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.empty-state {
  border: 1px dashed #94a3b8;
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  color: #475569;
  background: rgba(255, 255, 255, 0.65);
  min-width: 100%;
}

@media (max-width: 1100px) {
  .summary-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 880px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .content {
    padding: 16px;
  }

  .upload-card {
    flex-direction: column;
    align-items: stretch;
  }

  .upload-main {
    min-width: 0;
  }

  .pdf-controls {
    width: 100%;
  }

  .field-inline {
    flex: 1;
    min-width: 0;
  }

  .schedule-grid {
    display: grid;
    grid-template-columns: 1fr;
    overflow: visible;
    min-height: auto;
  }

  .day-card {
    flex: initial;
    max-height: none;
  }

  .day-head {
    position: static;
  }
}
