:root {
  --line: #d8e0ea;
  --accent: #3e6ea8;
  --accent-soft: #e9f1fb;
  --paper: #f4f7fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #65758b;
  --shadow: 0 18px 45px rgba(36, 55, 82, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: "Nanum Gothic", "Segoe UI", Arial, Helvetica, sans-serif;
  background:
    linear-gradient(135deg, rgba(62, 110, 168, 0.1), transparent 34%),
    linear-gradient(315deg, rgba(72, 139, 122, 0.1), transparent 30%),
    var(--paper);
}

body.detail-open {
  overflow: hidden;
}

.top-bar {
  width: 100%;
  min-height: 82px;
  padding: 16px clamp(20px, 5vw, 64px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  font-size: 20px;
  font-weight: 800;
  background: var(--accent);
  box-shadow: 0 10px 22px rgba(62, 110, 168, 0.24);
}

.brand h1 {
  margin: 0;
  color: var(--text);
  font-family: "Roboto", "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  line-height: 1.15;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-nav a {
  padding: 9px 13px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.top-nav a:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.tools-menu {
  position: relative;
}

.tools-trigger {
  padding: 9px 13px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  background: transparent;
  cursor: pointer;
}

.tools-trigger:hover,
.tools-trigger[aria-expanded="true"] {
  color: var(--accent);
  background: var(--accent-soft);
}

.tools-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 25;
  min-width: 200px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
}

.tools-menu:hover .tools-dropdown,
.tools-menu:focus-within .tools-dropdown {
  opacity: 1;
  pointer-events: auto;
}

.tools-item {
  padding: 10px 12px;
  border: 0;
  border-radius: 6px;
  text-align: left;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  background: transparent;
  cursor: pointer;
}

.tools-item:hover,
.tools-item:focus-visible {
  outline: none;
  color: var(--accent);
  background: var(--accent-soft);
}

.workspace {
  width: min(100%, 1080px);
  margin: 42px auto 56px;
  padding: 0 clamp(20px, 4vw, 36px);
}

.search-area {
  margin-bottom: 24px;
}

.search-area label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.search-area input {
  width: 100%;
  height: 58px;
  padding: 0 20px;
  border: 1px solid rgba(216, 224, 234, 0.95);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.search-area input:focus {
  outline: none;
  border-color: rgba(62, 110, 168, 0.46);
  box-shadow: 0 20px 52px rgba(36, 55, 82, 0.14);
}

.search-area input::placeholder {
  color: #91a0b4;
}

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

.global-search-results {
  margin-bottom: 24px;
  display: grid;
  gap: 14px;
}

.global-search-group {
  padding: 18px 20px;
  border: 1px solid rgba(216, 224, 234, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.global-search-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.global-search-group-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
}

.global-search-status {
  flex: 0 0 auto;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.global-search-status.is-registered {
  color: #1f7a4d;
  background: #e8f7ef;
}

.global-search-status.is-empty {
  color: var(--muted);
  background: var(--paper);
}

.global-search-items {
  max-height: min(360px, 40vh);
  overflow: auto;
  display: grid;
  gap: 10px;
}

.wc-source-items {
  display: grid;
  gap: 10px;
}

.global-search-more {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.workspace-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 24px;
}

.tool-box {
  position: relative;
  min-height: 178px;
  padding: 24px;
  border: 1px solid rgba(216, 224, 234, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.card-share-button {
  display: none;
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: #fee500;
  color: #191919;
  font-size: 16px;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(36, 55, 82, 0.18);
  cursor: pointer;
}

.card-share-button:hover,
.card-share-button:focus-visible {
  outline: none;
  filter: brightness(0.96);
}

.tool-box:hover,
.tool-box:focus-visible {
  transform: translateY(-4px);
  outline: none;
  border-color: rgba(62, 110, 168, 0.32);
  box-shadow: 0 24px 55px rgba(36, 55, 82, 0.14);
}

.tool-kicker {
  width: fit-content;
  margin: 0 0 18px;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  background: var(--accent-soft);
}

.tool-box h2 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 23px;
  font-weight: 700;
  line-height: 1.15;
}

.tool-box p:last-child {
  max-width: 34ch;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.detail-view {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 48px);
  background: rgba(12, 20, 34, 0.46);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.detail-view.is-open {
  opacity: 1;
  pointer-events: auto;
}

.detail-panel {
  width: min(100%, 1040px);
  min-height: min(720px, calc(100vh - 64px));
  padding: clamp(28px, 5vw, 56px);
  position: relative;
  border: 1px solid rgba(216, 224, 234, 0.9);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 30px 90px rgba(12, 20, 34, 0.3);
  transform: translateY(18px) scale(0.98);
  transition: transform 180ms ease;
}

.detail-view.is-open .detail-panel {
  transform: translateY(0) scale(1);
}

.detail-close {
  position: absolute;
  top: 22px;
  right: 22px;
  padding: 10px 14px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  background: var(--accent);
  cursor: pointer;
}

.detail-close:hover,
.detail-close:focus-visible {
  outline: none;
  background: #2f5d93;
}

.detail-kicker {
  width: fit-content;
  margin: 0 0 18px;
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  background: var(--accent-soft);
}

.detail-panel h2 {
  margin: 0 0 14px;
  padding-right: 92px;
  font-size: clamp(32px, 6vw, 56px);
  line-height: 1.1;
}

.detail-description {
  max-width: 62ch;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

.wc-search-panel {
  margin-top: 34px;
}

.wc-search-head {
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.wc-search-panel label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.excel-export {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  background: var(--accent);
  cursor: pointer;
}

.excel-export:hover,
.excel-export:focus-visible {
  outline: none;
  background: #2f5d93;
}

.wc-search-panel input {
  width: 100%;
  height: 58px;
  padding: 0 18px;
  border: 1px solid rgba(216, 224, 234, 0.95);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  background: #ffffff;
}

.wc-search-panel input:focus {
  outline: none;
  border-color: rgba(62, 110, 168, 0.5);
  box-shadow: 0 0 0 4px rgba(62, 110, 168, 0.12);
}

.wc-search-meta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.wc-results {
  max-height: min(430px, 42vh);
  overflow: auto;
  display: grid;
  gap: 10px;
}

.wc-result-item {
  padding: 16px;
  border: 1px solid #e1e6ee;
  border-radius: 8px;
  background: #fbfcff;
}

.wc-result-item p {
  margin: 0;
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 12px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

.wc-result-item p + p {
  margin-top: 8px;
}

.wc-result-item strong {
  color: var(--muted);
  font-weight: 800;
}

.margin-calc-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.margin-calc-field label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.margin-calc-field input {
  width: 100%;
  height: 58px;
  padding: 0 18px;
  border: 1px solid rgba(216, 224, 234, 0.95);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  background: #ffffff;
}

.margin-calc-field input:focus {
  outline: none;
  border-color: rgba(62, 110, 168, 0.5);
  box-shadow: 0 0 0 4px rgba(62, 110, 168, 0.12);
}

.margin-calc-result {
  margin-top: 20px;
}

.margin-calc-result p {
  margin: 0;
  padding: 20px 22px;
  border-radius: 8px;
  font-size: 20px;
  font-weight: 800;
}

.margin-calc-result .margin-low {
  color: #b3261e;
  background: #fbeaea;
  border: 1px solid #f0c6c4;
}

.margin-calc-result .margin-high {
  color: #2f5d93;
  background: #e9f1fb;
  border: 1px solid #c7d9ef;
}

.import-cost-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.import-cost-combo {
  display: flex;
  gap: 8px;
}

.import-cost-combo input {
  flex: 1 1 auto;
  min-width: 0;
}

.margin-calc-field select,
.import-cost-combo select {
  height: 58px;
  padding: 0 14px;
  border: 1px solid rgba(216, 224, 234, 0.95);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  background: #ffffff;
  cursor: pointer;
}

.import-cost-combo select {
  flex: 0 0 auto;
  width: 92px;
}

.margin-calc-field select:focus,
.import-cost-combo select:focus {
  outline: none;
  border-color: rgba(62, 110, 168, 0.5);
  box-shadow: 0 0 0 4px rgba(62, 110, 168, 0.12);
}

.import-cost-result {
  margin-top: 20px;
}

.import-cost-breakdown {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.import-cost-breakdown p {
  margin: 0;
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.import-cost-breakdown p span {
  color: var(--text);
  font-weight: 800;
}

.import-cost-final {
  padding: 20px 22px;
  border-radius: 8px;
  color: #1f7a4d;
  font-size: 24px;
  font-weight: 800;
  background: #e8f7ef;
  border: 1px solid #bfe6d2;
}

.po-receive-panel {
  margin-top: 34px;
}

.po-receive-panel label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.po-receive-row {
  display: flex;
  gap: 12px;
}

.po-receive-row input {
  flex: 1 1 auto;
  height: 58px;
  padding: 0 18px;
  border: 1px solid rgba(216, 224, 234, 0.95);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  background: #ffffff;
}

.po-receive-row input:focus {
  outline: none;
  border-color: rgba(62, 110, 168, 0.5);
  box-shadow: 0 0 0 4px rgba(62, 110, 168, 0.12);
}

.po-receive-submit {
  flex: 0 0 auto;
  padding: 0 20px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  background: var(--accent);
  cursor: pointer;
}

.po-receive-submit:hover,
.po-receive-submit:focus-visible {
  outline: none;
  background: #2f5d93;
}

.po-receive-submit:disabled {
  background: #9fb3cb;
  cursor: not-allowed;
}

.po-receive-result {
  margin-top: 16px;
}

.po-receive-result p {
  margin: 0;
  padding: 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
}

.po-receive-result .status-ok {
  color: #1f7a4d;
  background: #e8f7ef;
  border: 1px solid #bfe6d2;
}

.po-receive-result .status-error {
  color: #b3261e;
  background: #fbeaea;
  border: 1px solid #f0c6c4;
}

.cnph-head-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
}

.cnph-criteria {
  margin-bottom: 16px;
  padding: 16px 18px;
  border: 1px solid #e1e6ee;
  border-radius: 8px;
  background: #fbfcff;
}

.cnph-criteria ul {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
}

.cnph-criteria li {
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

.cnph-criteria strong {
  color: var(--accent);
}

.flag-cn,
.flag-kr,
.flag-in,
.flag-us {
  width: 1.15em;
  height: 0.77em;
  display: inline-block;
  vertical-align: middle;
  margin: 0 2px 0.15em;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.expired-label {
  margin-left: 8px;
  color: #d43838;
  font-weight: 800;
}

.worklog-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.worklog-fullscreen.is-open {
  opacity: 1;
  pointer-events: auto;
}

.worklog-topbar {
  flex: 0 0 auto;
  padding: 18px clamp(20px, 4vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
}

.worklog-topbar-title h2 {
  margin: 0 0 4px;
  color: var(--text);
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 800;
}

.worklog-topbar-title .wc-search-meta {
  margin: 0;
}

.worklog-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.worklog-topbar-actions input {
  height: 46px;
  width: min(320px, 46vw);
  padding: 0 16px;
  border: 1px solid rgba(216, 224, 234, 0.95);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  background: #ffffff;
}

.worklog-topbar-actions input:focus {
  outline: none;
  border-color: rgba(62, 110, 168, 0.5);
  box-shadow: 0 0 0 4px rgba(62, 110, 168, 0.12);
}

.worklog-close {
  padding: 0 18px;
  height: 46px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  background: var(--accent);
  cursor: pointer;
}

.worklog-close:hover,
.worklog-close:focus-visible {
  outline: none;
  background: #2f5d93;
}

.worklog-clear-button {
  padding: 0 18px;
  height: 46px;
  border: 1px solid #f0c6c4;
  border-radius: 8px;
  color: #b3261e;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  background: #fbeaea;
  cursor: pointer;
}

.worklog-clear-button:hover,
.worklog-clear-button:focus-visible {
  outline: none;
  background: #f6d9d8;
}

.worklog-dropzone {
  position: relative;
  flex: 1 1 auto;
  overflow: auto;
  padding: clamp(20px, 3vw, 40px) clamp(20px, 4vw, 48px) 48px;
}

.worklog-dropzone-overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(62, 110, 168, 0.12);
  border: 3px dashed var(--accent);
}

.worklog-dropzone-overlay p {
  padding: 20px 32px;
  border-radius: 12px;
  color: var(--accent);
  font-size: 22px;
  font-weight: 800;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.worklog-fullscreen.is-dragover .worklog-dropzone-overlay {
  display: flex;
}

.worklog-results {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.worklog-person {
  border: 1px solid #e1e6ee;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.worklog-person summary {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.worklog-person summary::-webkit-details-marker {
  display: none;
}

.worklog-person[open] summary {
  border-bottom: 1px solid #eef1f6;
}

.worklog-count {
  flex: 0 0 auto;
  padding: 5px 12px;
  border-radius: 999px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  background: var(--accent-soft);
}

.worklog-entries {
  padding: 18px 22px 22px;
  display: grid;
  gap: 16px;
}

.worklog-entry {
  padding: 18px 20px;
  border: 1px solid #eef1f6;
  border-radius: 10px;
  background: #fbfcff;
}

.worklog-entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eef1f6;
}

.worklog-entry-head .worklog-company {
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
}

.worklog-entry-head .worklog-material {
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
}

.worklog-entry-meta {
  margin-left: auto;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
}

.worklog-content {
  white-space: pre-wrap;
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.75;
}

@media (max-width: 720px) {
  .worklog-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .worklog-topbar-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .worklog-topbar-actions input {
    width: 100%;
  }

  .worklog-load-button,
  .worklog-clear-button,
  .worklog-close {
    display: none;
  }
}

.empty-result {
  margin: 0;
  padding: 26px;
  border: 1px dashed #cfd8e5;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
  background: #fbfcff;
}

@media (max-width: 720px) {
  .card-share-button {
    display: flex;
  }

  .top-bar {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px 18px;
  }

  .top-nav {
    width: 100%;
    justify-content: space-between;
  }

  .workspace-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .workspace {
    margin-top: 24px;
    padding: 0 18px 32px;
  }

  .search-area input {
    height: 54px;
    font-size: 16px;
  }

  .tool-box {
    min-height: 156px;
  }

  .detail-panel {
    min-height: calc(100vh - 36px);
    padding: 72px 22px 24px;
  }

  .detail-panel h2 {
    padding-right: 0;
  }

  .wc-result-item p {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .wc-search-head,
  .global-search-head {
    flex-direction: column;
  }

  .excel-export {
    width: 100%;
  }

  .margin-calc-inputs,
  .import-cost-inputs {
    grid-template-columns: 1fr;
  }
}
