/* Nordenos Support Portal — Precision SaaS surfaces matching Nordenos Invoices */
@font-face {
  font-family: Barlow;
  src: url('../assets/fonts/Barlow-Regular.otf') format('opentype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Barlow;
  src: url('../assets/fonts/Barlow-Medium.otf') format('opentype');
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: Barlow;
  src: url('../assets/fonts/Barlow-SemiBold.otf') format('opentype');
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: Inter;
  src: url('../assets/fonts/Inter-Variable.ttf') format('truetype');
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --font-body: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-heading: Barlow, var(--font-body);
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  --brand-primary: #348bf9;
  --brand-secondary: #112534;
  --accent: #348bf9;
  --accent-strong: #112534;
  --accent-soft: #edf5ff;

  --surface: #f2f3f4;
  --card: #ffffff;
  --soft: #f0f4f8;
  --text: #112534;
  --muted: #5e6e7e;
  --line: #e1e4e5;
  --line-strong: #cbd5d8;

  --success: #20a36a;
  --success-soft: #e8f8f0;
  --warning: #d89019;
  --warning-soft: #fff4df;
  --danger: #d95757;
  --danger-soft: #fff0f0;

  --shell-inset: 12px;
  --shell-gap: 12px;
  --sidebar-width: 252px;
  --shell-bg: #e1e5e7;
  --shell-border: #ffffffb3;
  --shell-shadow: inset 0 1px 0 #fff, inset 1px 0 0 #ffffff9c, inset -1px 0 0 #ffffff70, 0 1px 2px #343b3f0a, 0 7px 20px -12px #343b3f20;
  --panel-border: #ffffff;
  --panel-shadow: inset 0 1px 0 #fff, 0 1px 2px #30383d0a, 0 5px 15px -7px #30383d15;
}

body.dark {
  --surface: #111111;
  --card: #1e1e1e;
  --soft: #252525;
  --text: #f5f5f5;
  --muted: #929292;
  --line: #3a3a3a;
  --line-strong: #4e4e4e;
  --shell-bg: #111111;
  --shell-border: #3a3a3a;
  --shell-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  --panel-border: #3a3a3a;
  --panel-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 4px 16px rgba(0, 0, 0, 0.5);
  --accent-soft: rgba(52, 139, 249, 0.14);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--shell-bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

:focus-visible {
  outline: 3px solid var(--brand-primary);
  outline-offset: 2px;
}

/* Topbar (Invoices floating frame header) */
header.topbar {
  position: fixed;
  left: var(--shell-inset);
  right: var(--shell-inset);
  top: var(--shell-inset);
  z-index: 600;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}

.topbar-brand img {
  display: block;
  width: 158px;
  height: auto;
}

body.dark .topbar-brand img {
  filter: brightness(0) invert(1);
}

.topbar-product-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 7px;
  background: #ffffffb8;
  border: 1px solid #d5dce0;
  color: #1e293b;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

body.dark .topbar-product-tag {
  background: #1e1e1e;
  border-color: #3a3a3a;
  color: #e2e8f0;
}

.topbar-sla {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid #cbe4d6;
  background: #ebf8f1;
  color: #155e3d;
  font-size: 11.5px;
  font-weight: 600;
}

.topbar-sla[data-level="maintenance"] {
  border-color: #e3c98d;
  background: #fff4d9;
  color: #785312;
}

.topbar-sla[data-level="outage"] {
  border-color: #eeb4b4;
  background: #fff0f0;
  color: #9e2222;
}

body.dark .topbar-sla {
  background: #182b22;
  border-color: #264d3b;
  color: #8ce0b5;
}

body.dark .topbar-sla[data-level="maintenance"] {
  background: #322a18;
  border-color: #66542c;
  color: #f0d28d;
}

body.dark .topbar-sla[data-level="outage"] {
  background: #331a1a;
  border-color: #6b2c2c;
  color: #f59e9e;
}

.sla-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

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

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid #ffffff99;
  background: #f6f7f7;
  color: #53616a;
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 #fff, 0 1px 3px #343b3f12;
}

body.dark .icon-btn {
  background: #1e1e1e;
  border-color: #3a3a3a;
  color: #d4d4d4;
  box-shadow: none;
}

.emergency-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 8px;
  background: #ffffffb8;
  border: 1px solid #d5dce0;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
}

body.dark .emergency-chip {
  background: #1e1e1e;
  border-color: #3a3a3a;
}

/* Invoices-style Profile Chip in Topbar */
.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding-left: 12px;
  border-left: 1px solid var(--line-strong);
}

.profile-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--brand-primary);
  border: 1px solid var(--line-strong);
  font-weight: 700;
  font-size: 12px;
}

.profile-chip-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  max-width: 165px;
}

.profile-chip-copy span {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-chip-copy small {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-signout {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
}

.profile-signout:hover {
  color: var(--text);
  background: var(--soft);
}

/* Category Flow & Quick Issue Chips */
.category-flow-card {
  margin-bottom: 16px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid #d9e6f6;
  background: #f5f9ff;
}

body.dark .category-flow-card {
  background: #18202c;
  border-color: #29384d;
}

.category-flow-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.category-flow-head strong {
  font-size: 13px;
  color: var(--text);
}

.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}

.quick-chip {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid #cbd9eb;
  background: var(--card);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 500;
  transition: border-color 0.12s, background 0.12s;
}

.quick-chip:hover, .quick-chip.active {
  border-color: var(--brand-primary);
  background: var(--accent-soft);
  color: var(--brand-primary);
}

.detail-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.detail-pill {
  padding: 4px 9px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--soft);
  font-size: 11.5px;
  color: var(--text);
}

/* Sidebar navigation (Invoices floating left rail) */
aside.sidebar {
  position: fixed;
  inset: calc(var(--shell-inset) + 60px) auto var(--shell-inset) var(--shell-inset);
  z-index: 500;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  background: linear-gradient(160deg, #edf0f1, #e5e9eb);
  border: 1px solid var(--shell-border);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 #fff, 0 2px 3px #25374705, 0 8px 24px -12px #25374726;
}

body.dark aside.sidebar {
  background: linear-gradient(160deg, #1a1a1a, #151515);
  border-color: #3a3a3a;
  box-shadow: var(--shell-shadow);
}

.sidebar-lookup {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 10px;
  margin-bottom: 10px;
  background: #f6f8f9;
  border: 1px solid #d7dfe4;
  border-radius: 8px;
  box-shadow: inset 0 1px 2px #25374706;
}

body.dark .sidebar-lookup {
  background: #202020;
  border-color: #3a3a3a;
}

.sidebar-lookup input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  outline: none;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  overflow-y: auto;
}

.nav-group {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-group-title {
  padding: 6px 10px 4px;
  color: #647481;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #475569;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

body.dark .nav-item {
  color: #b8c2cc;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item:not(.nav-primary):not(.active):hover {
  background: #e2e8ee;
  color: #0f172a;
}

body.dark .nav-item:not(.nav-primary):not(.active):hover {
  background: #262626;
  color: #ffffff;
}

.nav-item.active:not(.nav-primary) {
  color: #0f172a;
  background: #dce2e5;
  border-color: #d5dce0;
  font-weight: 600;
  box-shadow: inset 0 1px 2px #25374708, 0 1px 0 #ffffff80;
}

body.dark .nav-item.active:not(.nav-primary) {
  color: #ffffff;
  background: #2a2a2a;
  border-color: #3e3e3e;
  box-shadow: none;
}

.nav-item.active:not(.nav-primary) svg {
  color: #0077ed;
}

.nav-item.nav-primary {
  margin: 2px 0 6px;
  background: linear-gradient(180deg, #0084ff 0%, #0072e5 100%);
  color: #ffffff;
  border: 1px solid rgba(0, 114, 229, 0.5);
  border-radius: 8px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 3px 8px rgba(0, 119, 237, 0.22);
}

.nav-item.nav-primary:hover {
  background: linear-gradient(180deg, #1a8eff 0%, #0079ed 100%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 0 6px 14px rgba(0, 119, 237, 0.32);
}

.sidebar-sla-card {
  margin-top: auto;
  padding: 12px;
  border-radius: 12px;
  background: #ffffffb8;
  border: 1px solid #ffffff;
  box-shadow: 0 2px 6px rgba(17, 37, 52, 0.04);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}

body.dark .sidebar-sla-card {
  background: #222222;
  border-color: #333333;
}

.sidebar-sla-card strong {
  display: block;
  color: var(--text);
  font-size: 12px;
  margin-bottom: 3px;
}

.sidebar-credit {
  padding: 10px 6px 2px;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Main Workspace Container (Invoices raised panel) */
main.main {
  margin-left: calc(var(--sidebar-width) + var(--shell-inset) + var(--shell-gap));
  margin-right: var(--shell-inset);
  padding-top: calc(var(--shell-inset) + 60px);
  padding-bottom: var(--shell-inset);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#viewContainer {
  flex: 1;
  padding: 30px 32px 44px;
  border: 1px solid var(--shell-border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shell-shadow);
}

.page {
  max-width: 1180px;
  margin: 0 auto;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-heading h1 {
  font-family: var(--font-heading);
  font-size: 31px;
  font-weight: 600;
  letter-spacing: -0.8px;
  line-height: 1.2;
  margin: 0 0 6px;
  color: var(--text);
}

.page-subtitle {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 680px;
}

/* Offline alert bar */
.offline-banner {
  margin-bottom: 18px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid #e7b8b8;
  background: var(--danger-soft);
  color: #9e2222;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  font-weight: 500;
}

/* Tactile White Cards */
.card {
  background: var(--card);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  box-shadow: var(--panel-shadow);
  padding: 24px;
}

.grid-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.85fr);
  gap: 20px;
  align-items: start;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
}

.field-hint {
  font-size: 11px;
  color: var(--muted);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select,
textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: border-color 0.15s, box-shadow 0.15s;
}

body.dark input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
body.dark select,
body.dark textarea {
  border-color: #3a3a3a;
  background: #161616;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(52, 139, 249, 0.16);
}

textarea {
  min-height: 116px;
  resize: vertical;
  line-height: 1.55;
}

/* Priority selector pills */
.priority-selector {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.priority-option {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--card);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.priority-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.priority-option strong {
  font-size: 12.5px;
  color: var(--text);
}

.priority-option span {
  font-size: 11px;
  color: var(--muted);
}

.priority-option:has(input:checked) {
  border-color: var(--brand-primary);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px rgba(52, 139, 249, 0.14);
}

.priority-option[data-prio="urgent"]:has(input:checked) {
  border-color: var(--danger);
  background: var(--danger-soft);
}

body.dark .priority-option[data-prio="urgent"]:has(input:checked) {
  background: rgba(217, 87, 87, 0.15);
}

/* Dropzone for screenshots */
.dropzone {
  border: 1.5px dashed var(--line-strong);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--brand-primary);
  background: var(--accent-soft);
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 11.5px;
  color: var(--text);
}

.attachment-chip button {
  border: 0;
  background: transparent;
  color: var(--danger);
  font-weight: 700;
  padding: 0 2px;
}

/* Buttons (Invoices electric blue CTA + light secondary) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--text);
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn.accent {
  background: linear-gradient(180deg, #0084ff 0%, #0072e5 100%);
  color: #ffffff;
  border-color: rgba(0, 112, 224, 0.5);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 3px 8px rgba(0, 119, 237, 0.22);
}

.btn.accent:hover:not(:disabled) {
  background: linear-gradient(180deg, #1a8eff 0%, #0079ed 100%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 0 6px 14px rgba(0, 119, 237, 0.32);
}

/* Badges & Statuses */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge.status-open { background: #eaf1ff; color: #1d4ed8; }
.badge.status-in_progress { background: #fff4df; color: #b4690e; }
.badge.status-waiting_client { background: #f3e8ff; color: #6d28d9; }
.badge.status-resolved { background: #e8f8f0; color: #157347; }

.badge.prio-urgent { background: #fff0f0; color: #c92a2a; border: 1px solid #ffc9c9; }
.badge.prio-high { background: #fff4df; color: #b4690e; }
.badge.prio-normal { background: var(--soft); color: var(--muted); }

/* Metric Cards (Admin Dashboard) */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.metric-card {
  padding: 18px 20px;
}

.metric-label {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
}

.metric-value {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 600;
  color: var(--text);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

/* Timeline & Messages */
.message-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 18px 0;
}

.message-item {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
}

.message-item.is-admin {
  border-left: 3px solid var(--brand-primary);
}

.message-item.is-internal {
  background: #fffbeb;
  border-color: #fde68a;
  border-left: 3px solid #d97706;
}

body.dark .message-item.is-internal {
  background: #2b2412;
  border-color: #66521e;
}

.message-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 6px;
}

.message-meta strong {
  color: var(--text);
}

.message-body {
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 13px;
}

/* Ticket table */
.ticket-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ticket-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}

.ticket-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.ticket-table tr:hover td {
  background: var(--soft);
  cursor: pointer;
}

@media (max-width: 960px) {
  aside.sidebar {
    position: static;
    width: auto;
    margin: calc(var(--shell-inset) + 56px) var(--shell-inset) 0;
  }
  main.main {
    margin-left: var(--shell-inset);
    padding-top: 12px;
  }
  .grid-layout, .form-grid-2, .metric-grid, .priority-selector {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  header.topbar {
    padding: 0 12px;
    gap: 8px;
  }
  .topbar-sla, .topbar-product-tag, .emergency-chip span {
    display: none;
  }
  .topbar-brand img {
    width: 124px;
  }
  #viewContainer {
    padding: 20px 16px 32px;
  }
  .ticket-table {
    display: block;
    overflow-x: auto;
  }
}
