/* Workspace shell is opt-in; public download and login retain their layout. */
.quick-portals { display:flex; align-items:center; gap:8px; margin-left:auto; margin-right:18px; }
.quick-portals a { font-size:13px; font-weight:650; text-decoration:none; padding:8px 16px; border:1px solid transparent; border-radius:7px; transition:filter 150ms; }
.quick-portals a:hover { filter:brightness(.94); }
#portal-veri { color:#064d43; background:#91e8d3; border-color:#6bd6bd; }
#portal-makro { color:#fff; background:#0071e3; border-color:#0068d1; }
body.internal-workspace { --sidebar-width:224px; }
body.sidebar-narrow { --sidebar-width:64px; }
.internal-workspace .app-header { padding:0 24px; }
.internal-workspace .app-shell { width:auto; max-width:none; margin:0 0 0 var(--sidebar-width); padding:32px clamp(18px,3%,40px) 60px; transition:margin-left 180ms var(--ease); }
.internal-workspace .app-shell > .workspace:not(.crm-workspace) { max-width:1120px; margin-inline:auto; }
.workspace-sidebar { position:fixed; inset:58px auto 0 0; width:var(--sidebar-width); background:#fafafa; border-right:1px solid var(--line); z-index:45; display:flex; flex-direction:column; padding:16px 10px; transition:width 180ms var(--ease); }
.workspace-sidebar nav { display:grid; gap:5px; }
.sidebar-collapse { align-self:flex-end; width:32px; height:32px; margin-bottom:22px; background:none; border:1px solid var(--line); border-radius:6px; font-size:23px; cursor:pointer; }
.sidebar-link { width:100%; border:0; border-radius:7px; background:none; text-align:left; display:flex; align-items:center; gap:12px; padding:12px; color:#55555b; cursor:pointer; font-size:13px; min-height:44px; }
.sidebar-link > span:first-child { font-size:21px; line-height:20px; flex:0 0 20px; text-align:center; }
.sidebar-link[aria-current=page] { background:var(--blue-soft); color:var(--blue); font-weight:650; }
.sidebar-link:hover { background:var(--fill-hover); }
.sidebar-bottom { margin-top:auto; }
.sidebar-bottom small { display:block; padding:12px; overflow-wrap:anywhere; font-size:11px; color:var(--secondary-label); }
.sidebar-narrow .nav-label { display:none; }
.sidebar-narrow .sidebar-collapse { align-self:center; }
.crm-page-heading { display:flex; justify-content:space-between; align-items:center; gap:16px; margin-bottom:24px; }
.crm-page-heading h1 { margin:0; font-size:28px; }
.crm-eyebrow { margin:0 0 6px; color:var(--secondary-label); font-size:10px; font-weight:700; }
.crm-tabs { display:flex; gap:24px; border-bottom:1px solid var(--line); margin-bottom:22px; overflow:auto; }
.crm-tabs button { padding:12px 0; border:0; border-bottom:2px solid transparent; white-space:nowrap; background:none; cursor:pointer; font-weight:600; color:var(--secondary-label); }
.crm-tabs button[aria-selected=true] { border-bottom-color:var(--blue); color:var(--blue); }
#crm-departments { max-width:240px; flex:0 1 240px; font-weight:600; }
.crm-toolbar { display:flex; align-items:center; flex-wrap:wrap; gap:10px; }
.crm-toolbar input[type=search] { flex:1 1 210px; width:auto; min-width:150px; }
.crm-filter-toggle { display:flex; align-items:center; gap:7px; min-height:40px; padding:8px 12px; font-size:12px; }
#crm-filter-count { border-radius:4px; padding:2px 5px; background:var(--blue-soft); color:var(--blue); font-size:10px; }
.crm-filters { display:flex; flex-wrap:wrap; align-items:end; gap:18px; padding:16px 0; margin-top:8px; border-bottom:1px solid var(--line); }
.crm-filters > label:not(.crm-archived) { display:grid; gap:6px; font-size:11px; color:var(--secondary-label); }
.crm-filters .crm-archived,.crm-filters .text-button { margin-bottom:10px; }
.crm-workspace input:not([type=checkbox]), .crm-workspace select, .crm-dialog input:not([type=checkbox]), .crm-dialog select, .crm-dialog textarea { font:inherit; font-size:13px; border:1px solid var(--line); border-radius:7px; background:white; color:var(--label); padding:10px 12px; min-height:40px; max-width:100%; }
.crm-workspace select { width:auto; }
.crm-workspace button:focus-visible,.crm-dialog :focus-visible { outline:3px solid var(--focus); outline-offset:2px; }
.crm-archived { display:flex; gap:6px; align-items:center; font-size:12px; white-space:nowrap; }
.crm-archived input,.crm-dialog input[type=checkbox],.crm-team-row input[type=checkbox] { width:16px; height:16px; accent-color:var(--blue); }
.crm-segment { display:flex; background:#e8e8ed; padding:3px; border-radius:7px; }
.crm-segment button { border:0; background:none; border-radius:5px; padding:7px 10px; cursor:pointer; font-size:12px; }
.crm-segment button[aria-pressed=true] { background:white; box-shadow:var(--shadow-small); }
.crm-icon { background:white; border:1px solid var(--line); border-radius:7px; width:36px; height:36px; font-size:20px; cursor:pointer; flex-shrink:0; }
.crm-summary { margin:18px 0 12px; display:flex; justify-content:space-between; gap:16px; color:var(--secondary-label); font-size:12px; }
.crm-board { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; align-items:start; }
.crm-column { min-width:0; padding:0 0 20px; --status-color:#94949c; }
.crm-column[data-status=in_progress] { --status-color:#0071e3; }
.crm-column[data-status=waiting_client] { --status-color:#ba8a00; }
.crm-column[data-status=done] { --status-color:#248a3d; }
.crm-column.drag-over { background:#e8f3ff; outline:2px dashed var(--blue); }
.crm-column-heading { display:flex; justify-content:space-between; align-items:center; gap:6px; margin:14px 0; }
.crm-column-heading h2 { margin:0; font-size:12px; font-weight:600; display:flex; align-items:center; gap:6px; }
.crm-column-heading h2::before { content:''; width:6px; height:6px; border-radius:50%; background:var(--status-color); flex-shrink:0; }
.crm-column-heading span { margin-left:5px; font-weight:400; color:var(--secondary-label); }
.crm-column-heading button { border:0; background:none; color:#6e6e73; font-size:20px; cursor:pointer; }
.crm-card { padding:17px; margin-bottom:12px; border:1px solid #e6e6eb; border-radius:8px; background:white; box-shadow:0 1px 3px #00000005; cursor:pointer; transition:box-shadow 150ms,transform 150ms; overflow-wrap:anywhere; }
.crm-card:hover { box-shadow:0 5px 16px #0000000d; transform:translateY(-1px); }
.crm-card-title { font-weight:600; font-size:14px; margin:9px 0 7px; line-height:1.5; }
.crm-card-client { font-size:12px; color:var(--secondary-label); margin:0 0 12px; }
.crm-card-top,.crm-card-bottom { display:flex; align-items:center; flex-wrap:wrap; gap:6px; font-size:10px; color:var(--secondary-label); }
.crm-card-bottom { padding-top:10px; margin-top:4px; font-size:11px; justify-content:space-between; }
.crm-card-assignee { max-width:110px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.crm-card-department { font-size:10px; }
.crm-repeat { margin-left:auto; font-size:14px; }
.crm-card-delivery { font-size:10px; margin:12px 0 0; padding-top:10px; border-top:1px solid #f1f1f3; color:var(--secondary-label); }
.crm-card-delivery.sent { color:#217e47; }
.crm-card-delivery.failed,.crm-card-delivery.uncertain { color:#b42335; }
.crm-badge { display:inline-block; padding:3px 6px; border-radius:4px; font-size:10px; background:var(--fill); }
.crm-badge.high,.crm-badge.urgent,.crm-overdue { color:#b42335; background:#fff0f1; }
.crm-badge.normal { color:#0062bd; background:#edf5ff; }
.crm-empty { text-align:center; padding:40px 16px; color:var(--secondary-label); font-size:14px; }
.crm-column .crm-empty { padding:28px 8px; font-size:12px; }
.crm-board.list-mode { display:block; }
.crm-board > .crm-empty { grid-column:1 / -1; }
.list-mode .crm-column[data-empty=true] { display:none; }
.list-mode .crm-column { border-top:0; }
.list-mode .crm-card { display:grid; grid-template-columns:minmax(150px,1.5fr) minmax(120px,1fr) minmax(160px,1fr); gap:4px 18px; align-items:center; }
.list-mode .crm-card-top { grid-column:1 / -1; }
.list-mode .crm-card-title,.list-mode .crm-card-client,.list-mode .crm-card-bottom { margin:0; padding:0; }
.list-mode .crm-card-delivery { grid-column:1 / -1; }
.crm-rule,.crm-team-row { border-bottom:1px solid var(--line); padding:20px 0; display:flex; justify-content:space-between; align-items:center; gap:20px; }
.crm-rule h3 { margin:0 0 6px; font-size:15px; }
.crm-rule p { margin:5px 0; font-size:12px; color:var(--secondary-label); }
.crm-rule-actions { display:flex; gap:8px; }
.crm-team-row { display:block; }
.crm-team-row > summary { cursor:pointer; list-style:none; }
.crm-team-row > summary::after { content:'+'; font-size:19px; color:var(--secondary-label); }
.crm-team-row[open] > summary::after { content:'−'; }
.crm-team-row > .secondary-button { margin-top:20px; }
.crm-team-heading { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:15px; }
.crm-team-heading strong { font-size:13px; overflow-wrap:anywhere; }
.crm-team-options { display:flex; flex-wrap:wrap; gap:14px; margin:14px 0 0; font-size:12px; }
.crm-team-options label { display:flex; align-items:center; gap:6px; }
.crm-settings { margin-top:32px; padding-top:24px; border-top:1px solid var(--line); max-width:720px; }
.crm-settings h2 { font-size:19px; }
.crm-settings p { font-size:13px; color:var(--secondary-label); line-height:1.6; }
.crm-settings pre { white-space:pre-wrap; padding:15px; background:white; border:1px solid var(--line); border-radius:7px; font:13px/1.6 inherit; }
.crm-dialog { color:var(--label); background:white; border:1px solid var(--line); border-radius:14px; box-shadow:var(--shadow-large); padding:0; width:min(760px,calc(100% - 28px)); max-height:90dvh; overflow:hidden; }
.crm-dialog form { display:flex; flex-direction:column; max-height:calc(90dvh - 2px); min-height:0; }
.crm-dialog::backdrop { background:#17171d60; backdrop-filter:blur(3px); }
.crm-dialog header { display:flex; justify-content:space-between; align-items:center; gap:16px; padding:20px 24px; border-bottom:1px solid var(--line); flex-shrink:0; }
.crm-dialog h2 { margin:0; font-size:21px; }
body.crm-modal-open { overflow:hidden; }
.crm-dialog-body { padding:24px; display:grid; grid-auto-rows:max-content; align-content:start; gap:22px; overflow-y:auto; overscroll-behavior:contain; min-height:0; scrollbar-gutter:stable; }
.crm-dialog-body > * { min-width:0; }
.crm-field-heading { display:flex; gap:8px; align-items:center; min-height:28px; }
.crm-dialog .crm-field-heading label { margin-right:auto; }
.crm-field-heading .crm-icon { width:28px; height:28px; font-size:19px; }
.crm-title-field,.crm-client-field { display:grid; gap:8px; min-width:0; }
.crm-dialog input:not([type=checkbox]),.crm-dialog select,.crm-dialog textarea { width:100%; min-width:0; font-weight:400; line-height:1.5; min-height:44px; }
.crm-dialog input[type=date] { cursor:pointer; color-scheme:light; }
.crm-dialog input[type=date]::-webkit-calendar-picker-indicator { cursor:pointer; padding:4px; width:18px; height:18px; }
#task-recurrence-fields { display:grid; gap:18px; margin-top:20px; }
#task-recurrence-fields > label { max-width:340px; }
.crm-dialog input:disabled,.crm-dialog select:disabled { background:var(--fill); color:var(--secondary-label); cursor:not-allowed; }
.crm-detail { border-top:1px solid var(--line); padding-top:16px; }
.crm-detail > summary { cursor:pointer; font-size:12px; font-weight:600; padding:2px 0; }
.crm-detail[open] > summary { margin-bottom:18px; }
.crm-documents { border-top:1px solid var(--line); padding-top:16px; }
.crm-file-row { display:flex; align-items:center; justify-content:space-between; gap:12px; border-bottom:1px solid #ededf0; padding:10px 0; }
.crm-file-row > div { min-width:0; }
.crm-file-row a { font-size:12px; color:var(--label); text-decoration:none; overflow-wrap:anywhere; }
.crm-file-row a:hover { color:var(--blue); text-decoration:underline; }
.crm-file-row small { display:block; color:var(--secondary-label); font-size:10px; margin-top:4px; }
.crm-file-row .crm-icon { width:28px; height:28px; font-size:16px; border:0; }
#task-file-state { margin-top:8px; }
.crm-send-option .crm-hint { margin:8px 0 0 25px; max-width:540px; }
.crm-send-option .crm-notification { margin-top:12px; }
.crm-notification > button { display:block; margin-top:8px; }
.crm-dialog label { display:grid; align-content:start; gap:8px; min-width:0; margin:0; font-size:12px; line-height:1.5; font-weight:600; }
.crm-dialog textarea { width:100%; resize:vertical; min-height:84px; }
.crm-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px 16px; align-items:start; }
.crm-fields.triple { grid-template-columns:repeat(3,minmax(0,1fr)); }
.crm-dialog label.crm-checkbox { display:flex; align-items:center; gap:9px; font-weight:400; }
.crm-dialog footer { display:flex; align-items:center; justify-content:flex-end; flex-shrink:0; gap:10px; padding:16px 24px; background:white; border-top:1px solid var(--line); }
.crm-dialog .form-error { margin:0; }
.crm-contact-results { border:1px solid var(--line); border-radius:7px; max-height:240px; overflow:auto; overscroll-behavior:contain; }
#task-contact-status { padding:10px 12px; background:#fafafa; }
.crm-contact-option { display:grid; gap:4px; width:100%; background:white; color:var(--label); border:0; border-top:1px solid #eee; text-align:left; padding:12px; cursor:pointer; font-size:13px; overflow-wrap:anywhere; }
.crm-contact-option small { color:var(--secondary-label); font-size:11px; }
.crm-contact-option:hover,.crm-contact-option:focus { background:var(--blue-soft); }
.crm-contact-selected { display:flex; gap:12px; align-items:center; justify-content:space-between; font-size:13px; padding:10px 12px; background:var(--blue-soft); border-radius:7px; }
#task-contact-name { min-width:0; overflow-wrap:anywhere; }
#task-contact-clear { flex-shrink:0; }
.crm-hint { font-size:12px; color:var(--secondary-label); line-height:1.5; margin:0; }
.crm-check-row { display:flex; align-items:center; gap:8px; margin-bottom:7px; }
.crm-check-row input[type=text] { flex:1; min-width:0; }
.crm-check-row button { border:0; background:none; color:var(--danger); font-size:20px; cursor:pointer; }
.crm-check-row:has(:checked) input[type=text] { text-decoration:line-through; color:var(--secondary-label); }
.crm-checks-label { display:flex; justify-content:space-between; align-items:center; font-size:12px; margin-bottom:8px; }
.crm-activity { border-top:1px solid var(--line); padding-top:16px; }
.crm-activity h3 { font-size:14px; margin-top:0; }
.crm-activity-item { padding:12px 0; border-bottom:1px solid #eee; }
.crm-activity-item small { font-size:10px; color:var(--secondary-label); }
.crm-activity-item p { font-size:13px; white-space:pre-wrap; overflow-wrap:anywhere; margin:6px 0 0; }
.crm-notification { font-size:12px; line-height:1.5; padding:12px; background:var(--fill); border-radius:7px; }
.crm-dialog button:disabled { cursor:wait; opacity:.55; }
@media(max-width:1150px) { .crm-board { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:700px) {
  body.internal-workspace { --sidebar-width:56px; }
  .internal-workspace .app-header { height:58px; padding:0 10px; }
  .internal-workspace .brand { font-size:14px; gap:5px; }
  .internal-workspace .brand img { width:24px; height:24px; }
  .quick-portals { gap:5px; margin-right:8px; }
  .quick-portals a { font-size:11px; padding:7px; }
  .quick-portals a span { display:none; }
  .workspace-sidebar { padding:14px 6px; }
  .workspace-sidebar .nav-label,.sidebar-collapse { display:none; }
  .sidebar-link { padding:12px; }
  .internal-workspace .app-shell { padding:22px 12px 40px; }
  .crm-page-heading { align-items:center; gap:12px; }
  .crm-page-heading h1 { font-size:21px; }
  .crm-page-heading .primary-button { padding:10px 12px; font-size:12px; }
  .crm-board { grid-template-columns:minmax(0,1fr); }
  .crm-column[data-empty=true] { display:none; }
  .crm-tabs { gap:18px; }
  .crm-tabs button { font-size:12px; }
  .crm-toolbar > select,.crm-toolbar input[type=search] { flex:1 1 100%; width:100%; min-width:0; }
  #crm-departments { flex:1 1 100%; max-width:none; }
  .crm-filters { gap:14px; }
  .crm-filters > label:not(.crm-archived) { flex:1 1 100%; }
  .crm-filters select { width:100%; }
  .crm-fields,.crm-fields.triple { grid-template-columns:minmax(0,1fr); }
  .crm-dialog-body { padding:18px; }
  .crm-dialog input:not([type=checkbox]),.crm-dialog select,.crm-dialog textarea { font-size:16px; }
  .crm-dialog header,.crm-dialog footer { padding:16px 18px; }
  .crm-dialog footer { flex-wrap:wrap; }
  .crm-rule { align-items:flex-start; flex-direction:column; gap:10px; }
  .list-mode .crm-card { display:block; }
  .list-mode .crm-card-title { margin:10px 0; }
  .list-mode .crm-card select { margin-top:10px; }
}
@media(prefers-reduced-motion:reduce) { .workspace-sidebar,.internal-workspace .app-shell,.crm-card { transition:none; } .crm-card:hover { transform:none; } }
