/* Simmons Boot UI theme adapted from the OCI CRM design system. */
:root {
  --oci-red: #E63329;
  --oci-red-dark: #B5261E;
  --oci-red-light: #FCE9E8;
  --oci-black: #1A1A1A;
  --primary: #E63329;
  --primary-dark: #B5261E;
  --primary-light: #FCE9E8;
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --surface-2: #FAFBFC;
  --surface-3: #F1F3F5;
  --border: #E4E7EB;
  --border-2: #D5D9DF;
  --text-1: #1F2329;
  --text-2: #4E5969;
  --text-3: #86909C;
  --text-4: #B0B6BF;
  --blue: #1664E5;
  --blue-light: #E6F0FE;
  --green: #00A86B;
  --green-light: #E6F7EF;
  --amber: #F59C00;
  --amber-light: #FFF6E5;
  --red: #E63329;
  --red-light: #FCE9E8;
  --gray: #6B7280;
  --gray-light: #F3F4F6;
  --sidebar-w: 220px;
  --topbar-h: 56px;
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  font-family: "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  background: var(--bg);
  color: var(--text-1);
}

body {
  overflow: hidden;
}

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

a {
  color: inherit;
  text-decoration: none;
}

.simmons-app-shell {
  display: flex;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

.simmons-sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.sidebar-logo {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo img {
  max-width: 126px;
  max-height: 36px;
  object-fit: contain;
}

.logo-divider {
  width: 1px;
  height: 18px;
  background: var(--border-2);
}

.logo-sub {
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
}

.logo-sub strong {
  color: var(--oci-red);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.nav-section {
  padding: 6px 0;
}

.nav-section-title {
  padding: 6px 16px;
  color: var(--text-4);
  font-size: 10px;
  font-weight: 700;
}

.nav-item-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 8px 16px;
  color: var(--text-2);
  font-size: 13px;
  transition: background 0.12s, color 0.12s;
}

.nav-item-link:hover {
  background: var(--surface-3);
  color: var(--text-1);
}

.nav-item-link.is-disabled {
  cursor: default;
  pointer-events: none;
}

.nav-item-link.active {
  background: var(--oci-red-light);
  color: var(--oci-red);
  font-weight: 700;
}

.nav-item-link.active::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--oci-red);
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: currentColor;
  opacity: 0.78;
}

.nav-icon svg {
  width: 16px;
  height: 16px;
}

.nav-badge {
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--amber-light);
  color: #B87200;
  font-size: 10px;
  font-weight: 700;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 10px 12px;
}

.user-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.user-name {
  color: var(--text-1);
  font-size: 12px;
  font-weight: 700;
}

.user-role {
  color: var(--text-3);
  font-size: 10px;
}

.simmons-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.topbar {
  height: var(--topbar-h);
  flex: 0 0 var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.page-title {
  margin: 0;
  color: var(--text-1);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.page-breadcrumb {
  padding-left: 10px;
  border-left: 1px solid var(--border);
  color: var(--text-3);
  font-size: 12px;
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-3);
  font-size: 12px;
}

.simmons-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 24px 24px;
  background: var(--bg);
}

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

.page-header h2 {
  margin: 0;
  color: var(--text-1);
  font-size: 20px;
  font-weight: 800;
}

.page-header p {
  margin: 4px 0 0;
  color: var(--text-3);
  font-size: 12px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 700;
}

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

.btn-primary:hover,
.btn-danger:hover {
  border-color: var(--oci-red-dark);
  background: var(--oci-red-dark);
  color: #fff;
}

.btn-outline-secondary,
.btn-ghost {
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text-2);
}

.btn-outline-secondary:hover,
.btn-ghost:hover {
  border-color: var(--text-3);
  background: var(--surface-3);
  color: var(--text-1);
}

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

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.card-title {
  margin: 0;
  color: var(--text-1);
  font-size: 14px;
  font-weight: 800;
}

.card-body {
  padding: 16px;
}

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

.metric-card {
  position: relative;
  min-height: 118px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.metric-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--metric-color, var(--oci-red));
}

.metric-label {
  color: var(--text-3);
  font-size: 12px;
  font-weight: 700;
}

.metric-value {
  margin-top: 8px;
  color: var(--text-1);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 25px;
  font-weight: 700;
}

.metric-sub {
  margin-top: 8px;
  color: var(--text-3);
  font-size: 11px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
}

.badge-red {
  background: var(--red-light);
  color: var(--red);
}

.badge-green {
  background: var(--green-light);
  color: #0F7A3F;
}

.badge-blue {
  background: var(--blue-light);
  color: var(--blue);
}

.badge-amber {
  background: var(--amber-light);
  color: #B87200;
}

.badge-gray {
  background: var(--gray-light);
  color: var(--gray);
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
  gap: 12px;
}

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

.placeholder-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  border: 1px dashed var(--border-2);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-3);
  text-align: center;
}

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

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.stat-row strong {
  color: var(--text-1);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 18px;
}

.stat-row span:first-child {
  color: var(--text-3);
  font-size: 12px;
}

.filter-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin: -20px -24px 16px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(245, 246, 248, 0.96);
}

.filter-field label,
.form-field label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
}

.form-control,
.form-select {
  min-height: 34px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background-color: var(--surface);
  color: var(--text-1);
  font-size: 13px;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--oci-red);
  box-shadow: 0 0 0 3px rgba(230, 51, 41, 0.12);
}

.form-check-input {
  accent-color: var(--oci-red);
}

.form-check-input:checked {
  border-color: var(--oci-red);
  background-color: var(--oci-red);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table th {
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 800;
}

.data-table td {
  color: var(--text-1);
  font-size: 12px;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: var(--surface-2);
}

.empty {
  padding: 36px 16px;
  color: var(--text-3);
  text-align: center;
}

.department-filter-bar {
  grid-template-columns: minmax(220px, 360px) auto auto;
  justify-content: start;
}

.department-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.38fr) minmax(0, 0.62fr);
  gap: 12px;
  align-items: start;
}

.department-tree-card,
.department-detail-card {
  min-height: 446px;
}

.department-tree {
  display: grid;
  max-height: 392px;
  overflow: auto;
  padding: 6px;
}

.department-tree-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  text-align: left;
}

.department-tree-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.department-tree-item:hover,
.department-tree-item.active {
  background: var(--surface-2);
  color: var(--text-1);
}

.department-tree-item.active {
  box-shadow: inset 3px 0 0 var(--oci-red);
}

.department-tree-toggle {
  position: relative;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-2);
  border-radius: 4px;
  background: var(--surface);
}

.department-tree-toggle::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 4px;
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--text-3);
  border-bottom: 2px solid var(--text-3);
  transform: rotate(-45deg);
}

.department-tree-toggle.is-expanded::before {
  left: 5px;
  top: 3px;
  transform: rotate(45deg);
}

.department-tree-toggle.is-empty {
  border-color: transparent;
  background: transparent;
}

.department-tree-toggle.is-empty::before {
  display: none;
}

.department-tree-name,
.department-tree-code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.department-tree-name {
  font-weight: 700;
}

.department-tree-code {
  color: var(--text-3);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.department-tree-empty {
  padding: 36px 16px;
  color: var(--text-3);
  font-size: 12px;
  text-align: center;
}

.department-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.department-list-card {
  margin-top: 12px;
}

.agreement-section {
  display: grid;
  gap: 16px;
}

.agreement-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.agreement-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.agreement-block-header h3 {
  margin: 0;
  color: var(--text-1);
  font-size: 14px;
  font-weight: 800;
}

.agreement-block-body {
  padding: 14px;
}

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

.signature-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
}

.signature-title {
  margin-bottom: 8px;
  color: var(--text-2);
  font-weight: 800;
}

.signature-canvas-wrap {
  border: 1px dashed var(--border-2);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.signature-canvas {
  display: block;
  width: 100%;
  height: 220px;
  touch-action: none;
}

.login-page {
  min-height: 100vh;
  display: flex;
  background: var(--oci-black);
}

.login-brand {
  position: relative;
  flex: 1 1 58%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(26, 26, 26, 0.98) 0%, rgba(45, 48, 55, 0.94) 62%, rgba(230, 51, 41, 0.88) 100%);
}

.login-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
}

.login-brand-content {
  position: relative;
  z-index: 1;
  width: min(620px, 84%);
  color: #fff;
}

.login-brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 46px;
}

.login-brand-logo img {
  max-height: 48px;
  max-width: 180px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.login-brand-label {
  border-left: 1px solid rgba(255, 255, 255, 0.28);
  padding-left: 12px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 800;
}

.login-brand h1 {
  margin: 0;
  font-size: 42px;
  font-weight: 900;
  line-height: 1.22;
}

.login-brand h1 strong {
  color: #FFB4AD;
}

.login-brand p {
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 15px;
  line-height: 1.7;
}

.login-feature-list {
  display: grid;
  gap: 12px;
  margin-top: 34px;
}

.login-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
}

.login-feature-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--oci-red);
  box-shadow: 0 0 0 4px rgba(230, 51, 41, 0.22);
}

.login-panel {
  flex: 0 0 42%;
  min-width: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background: var(--surface);
}

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

.login-card-header {
  margin-bottom: 28px;
  text-align: center;
}

.login-chip {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--oci-red-light);
  color: var(--oci-red);
  font-size: 12px;
  font-weight: 800;
}

.login-card-header h2 {
  margin: 0;
  color: var(--text-1);
  font-size: 26px;
  font-weight: 900;
}

.login-card-header p {
  margin: 8px 0 0;
  color: var(--text-3);
}

.login-input {
  position: relative;
  margin-bottom: 14px;
}

.login-input input {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  color: var(--text-1);
  font-size: 14px;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
}

.login-input input:focus {
  border-color: var(--oci-red);
  box-shadow: 0 0 0 3px rgba(230, 51, 41, 0.12);
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 18px;
  color: var(--text-2);
}

.login-submit {
  width: 100%;
  min-height: 46px;
  border: none;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--oci-red), var(--oci-red-dark));
  color: #fff;
  font-size: 15px;
  font-weight: 800;
}

.login-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  color: var(--text-3);
  font-size: 12px;
}

.auth-footer {
  position: fixed;
  left: 24px;
  bottom: 18px;
  z-index: 3;
  color: rgba(255, 255, 255, 0.52);
  font-size: 11px;
}

.auth-footer p {
  margin: 2px 0;
}

.coming-soon {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 360px;
}

.coming-soon .card {
  max-width: 560px;
  width: 100%;
}

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

  .grid-2,
  .grid-3,
  .department-layout {
    grid-template-columns: 1fr;
  }

  .filter-bar {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 768px) {
  body {
    overflow: auto;
  }

  .simmons-app-shell {
    min-height: 100vh;
    height: auto;
  }

  .simmons-sidebar {
    display: none;
  }

  .topbar {
    padding: 0 14px;
  }

  .page-breadcrumb,
  .topbar-right .topbar-date {
    display: none;
  }

  .simmons-content {
    padding: 16px 14px;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .metrics-grid,
  .filter-bar,
  .signature-grid,
  .department-filter-bar,
  .department-layout {
    grid-template-columns: 1fr;
  }

  .filter-bar {
    position: static;
    margin: 0 0 16px;
    padding: 0;
    border-bottom: none;
    background: transparent;
  }

  .login-brand {
    display: none;
  }

  .login-panel {
    min-width: 0;
    flex: 1 1 100%;
  }

  .auth-footer {
    display: none;
  }
}
