#org-structure-workspace { width: 100%; min-width: 0; color: #0f172a; }
#org-structure-workspace, #org-structure-workspace * { box-sizing: border-box; }
.org-page { width: 100%; min-width: 0; padding: 0 0 56px; }
.org-page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin: -16px -16px 0; padding: 25px 28px 22px; color: #fff; background: linear-gradient(120deg, #0f172a 0%, #172554 62%, #1d4ed8 150%); border-bottom: 1px solid rgba(255,255,255,.1); }
.org-page-header > div:first-child { min-width: 0; }
.org-page-header span { display: block; margin-bottom: 5px; color: #93c5fd; font-size: 11px; line-height: 1.2; font-weight: 800; letter-spacing: .1em; }
.org-page-header h1 { margin: 0; font-size: clamp(26px, 3vw, 38px); line-height: 1.08; letter-spacing: -.035em; }
.org-page-header p { max-width: 650px; margin: 8px 0 0; color: #cbd5e1; font-size: 14px; }
.org-header-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; min-width: 320px; }
.org-header-actions button { min-height: 40px; padding: 0 15px; border-radius: 10px; border: 1px solid rgba(255,255,255,.2); font-size: 13px; font-weight: 750; cursor: pointer; transition: .18s ease; }
.org-header-actions button:hover:not(:disabled) { transform: translateY(-1px); border-color: rgba(255,255,255,.4); }
.org-header-actions .org-secondary { color: #e2e8f0; background: rgba(15,23,42,.28); }
.org-header-actions .org-secondary b { display: inline-flex; justify-content: center; min-width: 20px; margin-left: 5px; padding: 2px 6px; border-radius: 999px; background: rgba(255,255,255,.12); }
.org-header-actions .org-primary { color: #0f172a; background: #fff; }
.org-header-actions button:disabled { color: #94a3b8; background: rgba(255,255,255,.12); cursor: default; }
.org-notice { margin: 14px 0 0; padding: 12px 15px; border: 1px solid; border-radius: 11px; font-size: 13px; font-weight: 650; }
.org-notice.success { color: #166534; border-color: #bbf7d0; background: #f0fdf4; }
.org-notice.error { color: #991b1b; border-color: #fecaca; background: #fef2f2; }
.org-overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.org-overview > div { min-width: 0; min-height: 105px; padding: 16px 17px; border: 1px solid #dbe4f0; border-radius: 14px; background: #fff; box-shadow: 0 5px 18px rgba(15,23,42,.035); }
.org-overview small { display: block; color: #64748b; font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .045em; }
.org-overview b { display: block; margin-top: 7px; color: #0f172a; font-size: 27px; line-height: 1; }
.org-overview > div > span { display: block; margin-top: 7px; color: #64748b; font-size: 12px; }
.org-overview-progress > span { height: 7px; overflow: hidden; border-radius: 999px; background: #e2e8f0; }
.org-overview-progress > span i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2563eb, #22c55e); }
.org-map-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 22px 1px 11px; }
.org-map-heading h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.org-map-heading p { margin: 4px 0 0; color: #64748b; font-size: 13px; }
.org-save-state { flex: 0 0 auto; padding: 6px 9px; border-radius: 999px; color: #166534; background: #dcfce7; font-size: 11px; font-weight: 700; }
.org-save-state.dirty { color: #9a3412; background: #ffedd5; }
.org-map { min-width: 0; padding: 21px; border: 1px solid #dbe4f0; border-radius: 16px; background: linear-gradient(#f8fafc, #f1f5f9); overflow: hidden; }
.org-company-node { display: flex; align-items: center; width: min(460px, 100%); margin: 0 auto; padding: 13px 15px; border: 1px solid #bfdbfe; border-radius: 13px; background: #fff; box-shadow: 0 8px 25px rgba(37,99,235,.09); }
.org-company-node > span { display: grid; place-items: center; width: 38px; height: 38px; margin-right: 11px; border-radius: 10px; color: #fff; background: #2563eb; font-weight: 900; }
.org-company-node div { min-width: 0; flex: 1; }
.org-company-node small { display: block; color: #64748b; font-size: 9px; font-weight: 800; letter-spacing: .1em; }
.org-company-node b { display: block; margin-top: 2px; font-size: 16px; }
.org-company-node em { color: #2563eb; font-size: 11px; font-style: normal; font-weight: 750; }
.org-company-line { width: 1px; height: 25px; margin: 0 auto; background: #94a3b8; }
.org-top-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(270px, 100%), 1fr)); align-items: start; gap: 16px; min-width: 0; }
.org-top-grid > .org-branch:only-child { grid-column: 1 / -1; }
.org-branch { min-width: 0; }
.org-top-grid > .org-branch:only-child > .org-department-card { width: min(460px, 100%); margin-inline: auto; }
.org-child-grid { --org-card-min: 230px; position: relative; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(var(--org-card-min), 100%), 1fr)); align-items: start; gap: 14px; width: 100%; margin-top: 28px; padding-top: 24px; }
.org-child-grid::before { content: ''; position: absolute; top: 0; left: 50%; width: 1px; height: 14px; background: #94a3b8; }
.org-child-grid.has-many::after { content: ''; position: absolute; top: 14px; left: max(calc(50% / var(--org-child-count)), 16px); right: max(calc(50% / var(--org-child-count)), 16px); height: 1px; background: #94a3b8; }
.org-child-grid > .org-branch { position: relative; }
.org-child-grid > .org-branch::before { content: ''; position: absolute; z-index: 0; top: -24px; left: 50%; width: 1px; height: 24px; background: #94a3b8; }
.org-child-grid > .org-branch > .org-department-card { position: relative; z-index: 1; width: 100%; height: 100%; }
.org-child-grid .org-child-grid { --org-card-min: 210px; grid-column: 1 / -1; margin-top: 18px; padding-top: 18px; }
.org-child-grid .org-child-grid::before { height: 10px; }
.org-child-grid .org-child-grid > .org-branch::before { top: -18px; height: 18px; }
.org-department-card { min-width: 0; overflow: hidden; padding: 15px; border: 1px solid #d8e1ed; border-top: 3px solid #2563eb; border-radius: 13px; background: #fff; box-shadow: 0 5px 16px rgba(15,23,42,.04); }
.org-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.org-type-badge { min-width: 0; overflow: hidden; padding: 4px 7px; border-radius: 6px; color: #1d4ed8; background: #eff6ff; font-size: 9px; font-weight: 850; letter-spacing: .075em; text-transform: uppercase; text-overflow: ellipsis; white-space: nowrap; }
.org-icon-button { flex: 0 0 auto; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 7px; color: #64748b; background: transparent; font-weight: 900; cursor: pointer; }
.org-icon-button:hover { color: #0f172a; background: #f1f5f9; }
.org-department-card h2 { margin: 10px 0 5px; overflow-wrap: anywhere; font-size: 17px; line-height: 1.2; letter-spacing: -.02em; }
.org-goal { min-height: 34px; margin: 0; color: #64748b; font-size: 11px; line-height: 1.45; }
.org-card-stats { display: flex; flex-wrap: wrap; gap: 5px; margin: 12px 0; }
.org-card-stats span { padding: 5px 7px; border-radius: 7px; color: #64748b; background: #f1f5f9; font-size: 10px; }
.org-card-stats b { color: #0f172a; }
.org-head { display: flex; align-items: center; gap: 8px; padding: 9px; border: 1px solid #e2e8f0; border-radius: 9px; background: #f8fafc; }
.org-avatar { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px; color: #1d4ed8; background: #dbeafe; font-size: 11px; font-weight: 850; }
.org-head > span:last-child { min-width: 0; }
.org-head small { display: block; color: #94a3b8; font-size: 9px; font-weight: 750; text-transform: uppercase; }
.org-head b { display: block; overflow: hidden; margin-top: 2px; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.org-role-list { display: grid; gap: 5px; margin-top: 9px; }
.org-role-row { display: flex; align-items: center; justify-content: space-between; gap: 9px; width: 100%; padding: 7px 8px; border: 1px solid transparent; border-radius: 8px; text-align: left; background: #f8fafc; cursor: pointer; }
.org-role-row:hover { border-color: #bfdbfe; background: #eff6ff; }
.org-role-row span { min-width: 0; }
.org-role-row b, .org-role-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-role-row b { font-size: 10px; }
.org-role-row small { margin-top: 2px; color: #64748b; font-size: 9px; }
.org-role-row em { display: grid; place-items: center; flex: 0 0 auto; min-width: 23px; height: 23px; padding: 0 5px; border-radius: 999px; color: #1d4ed8; background: #dbeafe; font-size: 9px; font-style: normal; font-weight: 800; }
.org-empty-roles { padding: 11px; border: 1px dashed #cbd5e1; border-radius: 8px; color: #94a3b8; text-align: center; font-size: 10px; }
.org-card-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.org-card-footer button { min-width: 0; min-height: 34px; padding: 0 7px; border: 1px solid #cbd5e1; border-radius: 8px; color: #334155; background: #fff; font-size: 9px; font-weight: 750; cursor: pointer; }
.org-card-footer button:hover { border-color: #93c5fd; color: #1d4ed8; background: #eff6ff; }
.org-empty-state { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; padding: 42px; border: 1px dashed #cbd5e1; border-radius: 14px; background: #fff; }
.org-empty-state span { margin: 6px 0 14px; color: #64748b; font-size: 12px; }
.org-empty-state button, .org-load-error button { padding: 9px 14px; border: 0; border-radius: 9px; color: #fff; background: #2563eb; font-weight: 750; cursor: pointer; }
.org-overlay { position: fixed; z-index: 89; inset: 0; background: rgba(15,23,42,.42); backdrop-filter: blur(2px); }
.org-editor, .org-employees-drawer { position: fixed; z-index: 90; top: 0; right: 0; display: flex; flex-direction: column; width: min(520px, 100vw); height: 100dvh; border-left: 1px solid #cbd5e1; background: #fff; box-shadow: -20px 0 50px rgba(15,23,42,.18); }
.org-editor header, .org-employees-drawer header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px; color: #fff; background: #0f172a; }
.org-editor header small, .org-employees-drawer header small { color: #93c5fd; font-size: 9px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.org-editor header h2, .org-employees-drawer header h2 { margin: 4px 0 0; font-size: 20px; }
.org-editor header button, .org-employees-drawer header button { width: 34px; height: 34px; border: 1px solid #334155; border-radius: 9px; color: #e2e8f0; background: transparent; cursor: pointer; }
.org-editor-body { flex: 1; overflow: auto; padding: 20px 22px; }
.org-editor label { display: block; margin-bottom: 14px; color: #475569; font-size: 11px; font-weight: 750; }
.org-editor input, .org-editor textarea, .org-editor select, .org-employees-drawer select { display: block; width: 100%; margin-top: 5px; padding: 10px 11px; border: 1px solid #cbd5e1; border-radius: 9px; color: #0f172a; background: #fff; font: inherit; font-size: 13px; outline: none; }
.org-editor input:focus, .org-editor textarea:focus, .org-editor select:focus, .org-employees-drawer select:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.org-editor textarea { resize: vertical; }
.org-editor-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.org-editor-section { margin-top: 20px; padding-top: 17px; border-top: 1px solid #e2e8f0; }
.org-editor-section > div:first-child b, .org-editor-section > div:first-child span { display: block; }
.org-editor-section > div:first-child span { margin-top: 3px; color: #64748b; font-size: 10px; }
.org-editor-role-list { display: grid; gap: 7px; margin-top: 10px; }
.org-editor-role { display: grid; grid-template-columns: minmax(0, 1fr) auto 34px; gap: 6px; }
.org-editor-role input { margin: 0; }
.org-editor-role button { border: 1px solid #cbd5e1; border-radius: 8px; color: #334155; background: #fff; font-size: 10px; font-weight: 700; cursor: pointer; }
.org-editor-role button.danger { color: #dc2626; }
.org-add-row { width: 100%; min-height: 38px; margin-top: 9px; border: 1px dashed #93c5fd; border-radius: 8px; color: #1d4ed8; background: #eff6ff; font-size: 11px; font-weight: 750; cursor: pointer; }
.org-delete-department { width: 100%; min-height: 40px; margin-top: 28px; border: 1px solid #fecaca; border-radius: 9px; color: #b91c1c; background: #fff; font-size: 11px; font-weight: 750; cursor: pointer; }
.org-editor footer { display: flex; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid #e2e8f0; }
.org-editor footer button, .org-employees-drawer footer button { min-height: 39px; padding: 0 18px; border: 0; border-radius: 9px; color: #fff; background: #2563eb; font-weight: 750; cursor: pointer; }
.org-search { display: flex; align-items: center; gap: 7px; margin: 16px 18px 8px; padding: 0 11px; border: 1px solid #cbd5e1; border-radius: 9px; }
.org-search span { color: #64748b; font-size: 21px; }
.org-search input { width: 100%; min-height: 42px; border: 0; outline: 0; font-size: 13px; }
.org-employee-list { flex: 1; overflow: auto; padding: 8px 18px 18px; }
.org-employee-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) minmax(150px, .9fr); align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid #e2e8f0; }
.org-employee-main { min-width: 0; }
.org-employee-main b, .org-employee-main small, .org-employee-main em { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-employee-main b { font-size: 12px; }
.org-employee-main small { margin-top: 2px; color: #64748b; font-size: 10px; }
.org-employee-main em { width: max-content; margin-top: 4px; padding: 2px 5px; border-radius: 4px; color: #166534; background: #dcfce7; font-size: 8px; font-style: normal; font-weight: 750; }
.org-employee-row label > span, .org-employee-row label > small { display: block; color: #64748b; font-size: 9px; }
.org-employee-row select { margin: 3px 0; padding: 7px 8px; font-size: 10px; }
.org-employees-drawer footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-top: 1px solid #e2e8f0; color: #64748b; font-size: 11px; }
.org-empty-employees { padding: 40px 10px; color: #94a3b8; text-align: center; font-size: 12px; }
.org-muted { color: #94a3b8; font-size: 11px; }
.org-loading, .org-load-error { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 480px; gap: 10px; color: #64748b; }
.org-loading i { width: 34px; height: 34px; border: 3px solid #dbeafe; border-top-color: #2563eb; border-radius: 50%; animation: org-spin .8s linear infinite; }
.org-load-error b { color: #0f172a; font-size: 18px; }
.org-load-error span { max-width: 420px; text-align: center; }
@keyframes org-spin { to { transform: rotate(360deg); } }

@media (max-width: 1120px) {
  .org-page-header { flex-direction: column; }
  .org-header-actions { justify-content: flex-start; min-width: 0; }
  .org-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .org-top-grid { grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); }
  .org-child-grid { --org-card-min: 215px; }
}
@media (max-width: 760px) {
  .org-page-header { margin: -16px -16px 0; padding: 20px 17px; }
  .org-header-actions { width: 100%; }
  .org-header-actions button { flex: 1 1 140px; }
  .org-overview { grid-template-columns: 1fr 1fr; }
  .org-overview > div { min-height: 92px; padding: 13px; }
  .org-map-heading { align-items: flex-start; flex-direction: column; }
  .org-map { padding: 14px; }
  .org-top-grid { grid-template-columns: 1fr; }
  .org-child-grid, .org-child-grid .org-child-grid { grid-template-columns: 1fr; gap: 12px; margin-top: 18px; padding: 0 0 0 20px; }
  .org-child-grid::before, .org-child-grid.has-many::after, .org-child-grid .org-child-grid::before { top: 0; left: 7px; right: auto; width: 1px; height: 100%; }
  .org-child-grid > .org-branch::before, .org-child-grid .org-child-grid > .org-branch::before { top: 24px; left: -13px; width: 13px; height: 1px; }
  .org-editor-two { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .org-overview { grid-template-columns: 1fr; }
  .org-employee-row { grid-template-columns: 36px minmax(0, 1fr); }
  .org-employee-row > label { grid-column: 1 / -1; }
  .org-editor-role { grid-template-columns: minmax(0, 1fr) 34px; }
  .org-editor-role button:not(.danger) { grid-column: 1 / -1; min-height: 32px; grid-row: 2; }
}
