/* Square-derived shared presentation layer — Collabo, 2026-10-22.
 * Reference: squaredot/public/css/style.css (final light rail, page-header,
 * admin-tabs/admin-subtabs, bid-table, modal-box.drawer, form-grid).
 * Adaptation only: existing Collabo DOM, route hooks, focus/resize handlers,
 * KOCCA palette and admin-ui dimensions remain authoritative. No Square logo,
 * brand colors, variable fonts or business logic are copied.
 * Update policy: this is the single Collabo adaptation boundary; review source
 * changes against these contracts instead of duplicating styles per route.
 */
:root {
  --square-ui-control-height: 36px;
  --square-ui-touch-height: 44px;
  --square-ui-nav-indicator: 4px;
  --square-ui-hover: color-mix(in srgb, var(--au-primary) 4%, var(--surface));
  --square-ui-selected: color-mix(in srgb, var(--au-primary) 8%, var(--surface));
  --square-ui-drawer-width: 600px;
}
/* Preview notice participates in shell sizing instead of adding a second
 * viewport below the banner. This does not alter production auth or scopes. */
body:has(>.preview-notice) { display:flex; flex-direction:column; height:100dvh; }
body:has(>.preview-notice)>.preview-notice { flex:none; }
body:has(>.preview-notice)>#app { height:0; min-height:0; flex:1; }
body:has(>.preview-notice)>#app>.side { height:100%; }
body:has(>.preview-notice)>#auth { min-height:0; flex:1; overflow:auto; }

/* Square's final light sidebar, not its earlier dark-rail declarations. */
#app:not(.public-landing-mode) .side { background: var(--surface2); }
.side .wm { padding: 0 20px 20px; }
#nav { padding: 0 8px; scrollbar-gutter: stable; }
#nav a,
.nav-sec-btn {
  min-height: 40px;
  padding: 8px 12px;
  border-inline-start: var(--square-ui-nav-indicator) solid transparent;
  border-radius: 0;
  font-size: var(--au-fs-body);
  line-height: 1.5;
}
#nav a:hover,
.nav-sec-btn:hover { background: var(--square-ui-hover); color: var(--ink); }
#nav a.on,
.nav-group.active .nav-sec-btn,
.nav-sec-btn[aria-expanded="true"] {
  border-inline-start-color: var(--au-primary);
  background: var(--square-ui-selected);
  color: var(--au-primary);
}
#navAux .nav-sec-btn { min-height: 36px; padding: 8px 12px; }
.nav-label { display:flex; align-items:center; gap:12px; min-width:0; }
.nav-label > span { min-width:0; }
.nav-icon { width:20px; height:20px; flex:0 0 20px; }
#navAux .nav-group[data-sec="시스템 설정"] { border-inline-start:4px solid var(--accent); background:var(--accent-t); }
.nav-flyout .nav-icon { width:16px; height:16px; flex-basis:16px; }
.nav-flyout { padding: 8px; border-color: var(--line); }
.nav-flyout a { min-height: 40px; border-radius: 0; padding: 8px 12px; }
.nav-flyout a:hover { background: var(--square-ui-selected); }
.side-foot { padding: 16px 12px 0; gap: var(--ui-control-gap); }
.side-foot .btn { min-height: var(--square-ui-control-height); }

/* One quiet page heading, then controls and content. Avoid new height locks:
 * long pages retain their existing scroll container and full-bleed tools. */
.topbar { gap: 16px; background: var(--surface); }
.topbar h2 { font-size: var(--au-fs-page); line-height: 1.4; }
.content:not(.full-bleed) { padding-block: 24px; }
.card { padding: 20px; border-color: var(--line); box-shadow: none; }
.card h3 { font-size: var(--au-fs-section); line-height: 1.5; }
.card h3:not(:first-child) { margin-top: 20px; }
.stats { gap: 16px; }
.stat { padding: 16px; }
.cards { gap: 16px; }
.cards .c { padding: 20px; box-shadow: none; }
.cards .c.clk:hover { transform: none; background: var(--square-ui-hover); }
.cards .c.clk:active { transform: none; }

/* Square hierarchy: primary section tabs = underline; secondary choices =
 * filled rectangular controls. No tab panel display state is overridden. */
.tabs.section-tabs {
  align-items: stretch;
  gap: var(--ui-control-gap);
  padding: 0 0 var(--ui-scroll-clearance);
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  scrollbar-gutter: stable;
}
.tabs.section-tabs > .tab {
  min-height: 40px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 4px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--sub);
}
.tabs.section-tabs > .tab:hover { color: var(--ink); background: var(--square-ui-hover); }
.tabs.section-tabs > .tab.on,
.tabs.section-tabs > .tab[aria-selected="true"] {
  border-bottom-color: var(--au-primary);
  color: var(--au-primary);
  background: transparent;
}
.tabs:not(.section-tabs) { gap: var(--ui-control-gap); }
.tabs:not(.section-tabs) > .tab,
.news-category-tabs button {
  min-height: var(--square-ui-control-height);
  border-radius: var(--au-radius-sm);
  padding: 8px 12px;
}
.tabs:not(.section-tabs) > .tab.on,
.news-category-tabs button[aria-selected="true"] {
  color: var(--au-primary-ink);
  background: var(--au-primary);
}
.tabs.sub { margin-block: 12px 16px; }
.section-tab-panel .tabs.section-tabs { border-bottom:0; padding:8px; background:var(--surface2); border-radius:var(--au-radius-sm); }
.section-tab-panel .tabs.section-tabs > .tab { border:1px solid transparent; border-radius:var(--au-radius-sm); }
.section-tab-panel .tabs.section-tabs > .tab.on { background:var(--au-primary); color:var(--au-primary-ink); }

/* Buttons are intrinsic width in work areas; login and explicit inline widths
 * remain untouched. Shared action rows own spacing, not individual screens. */
:where(.content, .p-body) .btn {
  width: auto;
  max-width: 100%;
  min-height: var(--square-ui-control-height);
  padding: 8px 16px;
  gap: var(--ui-control-gap);
  line-height: 1.4;
  text-decoration: none;
}
:where(.content, .p-body) .btn.sm { padding: 8px 12px; }
:where(.content, .p-body) .btn.line { color: var(--au-primary); border-color: var(--line2); }
:where(.content, .p-body) .btn.line:hover { background: var(--square-ui-hover); }
:where(.content, .p-body) .btn:focus-visible,
:where(.content, .p-body) .tab:focus-visible,
.p-act button:focus-visible { outline: 2px solid var(--au-primary); outline-offset: 4px; }
.ui-action-row, .row-act, .c-a, .viewsw, .pr-actions-row,
.space-filters, .ops-work-toolbar { gap: var(--ui-control-gap); }
.ui-action-row { row-gap: 12px; }

/* Existing dataTable search/filter/sort contracts stay intact. */
.dt-bar {
  align-items: center;
  gap: var(--ui-control-gap);
  padding-bottom: var(--ui-scroll-clearance);
  margin-top: 16px;
}
.dt-bar .dt-q,
.dt-bar .dt-filter,
.center-news-toolbar .dt-q,
.news-filters select,
.news-filters input,
.news-filters .btn {
  min-height: var(--square-ui-control-height);
  height: var(--square-ui-control-height);
  padding: 8px 12px;
  font-size: var(--au-fs-body);
}
.dt-q { flex: 1 1 240px; max-width: 340px; min-width: 0; }
.dt-n { font-size: var(--au-fs-sm); color: var(--sub); }
.dt-wrap { margin-top: 8px; border-color: var(--line); border-radius: var(--au-radius-sm); }
table.dt { font-size: var(--au-fs-body); }
table.dt th, table.dt td { padding: 12px; }
table.dt thead th {
  font-size: var(--au-fs-sm);
  background: var(--surface2);
  color: var(--ink2);
  border-bottom-color: var(--line2);
}
table.dt tbody tr:hover { background: var(--square-ui-hover); }
table.dt .dt-sort { min-height: 24px; }
table.dt td .btn { min-height: 32px; padding: 4px 12px; }

/* Form and drawer rhythm is shared across company, role, news and PR views. */
:where(.content, .p-body) :where(input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=range]):not([type=file]), select, textarea) {
  border-color: var(--line2);
  border-radius: var(--au-radius-sm);
  background-color: var(--surface);
  font-size: var(--au-fs-body);
  line-height: 1.5;
}
:where(.content, .p-body) :where(input, select, textarea):focus-visible {
  outline: 2px solid var(--au-primary);
  outline-offset: 2px;
}
:where(.content, .p-body) :where(input, select, textarea):disabled {
  background-color: var(--surface2);
  color: var(--sub);
}
.drawer .p-box { width: min(var(--square-ui-drawer-width), 96vw); }
.p-head { padding: 16px 24px; gap: 16px; background: var(--surface); }
.p-head > b { font-size: var(--au-fs-section); line-height: 1.5; }
.p-act { gap: var(--ui-control-gap); }
.p-act button { min-height: 32px; padding: 8px; border-radius: var(--au-radius-sm); }
.p-body { padding: 24px; }
.p-body .kv { padding: 12px 0; gap: 16px; }
.p-body h3 { margin-block: 24px 12px; }
.p-body h3:first-child { margin-top: 0; }
.content, .p-body, .dt-wrap, .nav-flyout {
  scroll-padding: var(--ui-scroll-clearance);
  scrollbar-gutter: stable;
}

/* Auth and introduction share the same restrained surfaces without changing
 * their authentication flow, text, assets or published newsletter output. */
.auth-form { padding:24px; border:1px solid var(--line); border-radius:var(--au-radius); background:var(--surface); }
.auth-form .btn { min-height:40px; border-radius:var(--au-radius-sm); }
.auth-form p:has(> .btn) { display:flex; align-items:center; gap:var(--ui-control-gap); flex-wrap:wrap; }
#app.public-landing-mode { height:100dvh; min-height:0; overflow:hidden; }
.public-landing-mode>.main { height:100%; min-height:0; }
.public-landing-mode #view { height:100%; overflow:hidden; }
.public-landing { height:100%; padding-inline:28px; display:flex; flex-direction:column; }
.public-header { min-height:64px; padding-block:12px; flex:none; }
.public-header nav { gap:16px; }
.public-access-actions { display:inline-flex; flex-wrap:wrap; align-items:center; gap:var(--ui-control-gap); }
.public-access-actions>button:not(.btn) { min-height:36px; padding:8px; border:0; background:transparent; color:var(--au-primary); font:inherit; }
.public-feature-row>.public-access-actions { justify-self:end; }
.public-sections { flex:1; min-height:0; display:flex; flex-direction:column; padding-top:16px; }
.public-sections>.tabs { flex:none; }
.public-sections>.section-tab-panel { flex:1; min-height:0; overflow:auto; padding-inline-end:8px; scrollbar-gutter:stable; }
.public-hero { gap:32px; padding-block:24px; }
.public-hero h1 { font-size:clamp(28px,3vw,40px); margin-bottom:20px; }
.public-workflow { padding:24px; border-radius:var(--au-radius); }
.public-facts { padding-block:16px; margin-bottom:24px; }
.public-features { padding-block:8px 24px; }
.public-updates { padding-block:8px 24px; }
.public-footer { flex:none; padding-block:12px; margin-top:12px; font-size:var(--au-fs-xs); }

/* Mobile keeps meaningful touch targets and independent scrollable tables.
 * Preserve full-bleed editors and do not hide any content to fit the viewport. */
@media (max-width: 768px) {
  .content:not(.full-bleed) { padding: 16px; }
  .card, .cards .c { padding: 16px; }
  .stats, .cards { gap: 12px; }
  .tabs.section-tabs { flex-wrap: wrap; overflow-x: visible; row-gap: 8px; }
  .tabs.section-tabs > .tab { flex: 0 1 auto; min-height:var(--square-ui-touch-height); }
  .dt-bar .dt-q, .dt-bar .dt-filter { max-width: 100%; width: 100%; flex-basis: 100%; }
  :where(.content, .p-body) .btn,
  .tabs > .tab,
  .news-category-tabs button,
  .p-act button { min-height: var(--square-ui-touch-height); }
  table.dt td .btn { min-height:var(--square-ui-touch-height); }
  .dt-bar .dt-q, .dt-bar .dt-filter { min-height: var(--square-ui-touch-height); height: auto; }
  .p-head { padding: 12px 16px; }
  .p-body { padding: 16px; }
  .p-body .kv { gap: 12px; }
  .public-landing { padding-inline:16px; }
  .public-header { gap:8px; padding-block:12px; }
  .public-header nav { gap:8px 16px; }
  .public-hero { grid-template-columns:1fr; gap:20px; padding-block:8px 20px; }
  .public-footer { padding-block:8px; }
  .public-footer p { margin-block:8px; }
  .public-access-actions>button:not(.btn) { min-height:44px; }
  .public-feature-row>.public-access-actions { justify-self:start; margin-top:12px; }
}
@media (max-width: 480px) {
  .drawer .p-box { width: 100%; min-width: 0; }
  .p-body .kv > span { flex-basis: 104px; }
  .p-body .kv.pair > span { flex-basis: auto; }
  .p-head { align-items: flex-start; }
}
