@import url('portal-theme.css');
@import url('report-issue-nav.css?v=8');
@import url('sidebar-shell.css?v=14');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  direction: rtl;
}
body {
  font-family: var(--font);
  background: radial-gradient(ellipse 120% 80% at 50% 0%, var(--sw-bg-tint, #e6f4f8), var(--sw-bg, #f9fbfc) 55%);
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

.loading {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--muted);
  font-size: 14px;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(212, 175, 55, 0.35);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.layout {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: 268px 1fr;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}
.layout .sidebar {
  grid-column: 1;
  grid-row: 1;
}
.layout .main {
  grid-column: 2;
  grid-row: 1;
}
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.signout:hover { background: var(--shell-sidebar-hover); color: #fff; }

/* Platform status — auto incident response */
.platform-notice {
  margin: 0;
  padding: 14px 20px;
  font-size: 14px;
  line-height: 1.45;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  z-index: 20;
}
.platform-notice__inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.platform-notice__text p {
  margin: 4px 0 0;
  opacity: 0.92;
}
.platform-notice__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.platform-notice--investigating {
  background: #fff8e6;
  color: #5c4a12;
  border-bottom-color: #e8d48a;
}
.platform-notice--resolved {
  background: #ecfdf3;
  color: #14532d;
  border-bottom-color: #86efac;
}
.platform-notice__refresh {
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  background: #14532d;
  color: #fff;
}
.platform-notice__dismiss {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.55;
  padding: 4px 8px;
}
.platform-notice__dismiss:hover {
  opacity: 1;
}

.main {
  position: relative;
  background: var(--bg);
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* AI Assistant — hub sidebar + full-height assistant panel */
.main.hub-ai-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.main.hub-ai-main .hub-ai-panel {
  flex: 1;
  min-height: 0;
}
.page-banner {
  background: transparent;
  border-bottom: none;
  padding: 24px 40px 8px;
  color: var(--ink);
}
.page-banner .eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--purple);
  margin-bottom: 10px;
}
.page-banner h1 {
  font-family: var(--font-h);
  font-size: clamp(28px, 3.5vw, 38px);
  font-weight: 400;
  line-height: 1.15;
  margin-bottom: 10px;
  color: var(--ink);
}
.page-banner p {
  font-size: 14px;
  color: var(--muted);
  max-width: 720px;
  line-height: 1.7;
}
.page-body { padding: 28px 40px 56px; max-width: 1040px; }
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-head h2 { font-size: 22px; font-weight: 700; color: var(--ink); }
.page-head p { font-size: 14px; color: var(--muted); margin-top: 4px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--purple);
  border: 0;
  cursor: pointer;
  box-shadow: var(--shadow-purple);
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.btn:hover {
  background: var(--purple-light);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(157, 27, 99, 0.28);
}
.btn-outline {
  background: #fff;
  color: var(--purple-deep);
  border: 1px solid var(--line);
  box-shadow: none;
}
.btn-outline:hover,
.btn.btn-outline:hover {
  background: #fff;
  color: var(--purple-deep);
  border-color: var(--purple);
  box-shadow: 0 4px 12px rgba(157, 27, 99, 0.12);
  transform: translateY(-1px);
}
.btn-sm { padding: 9px 16px; font-size: 12px; }

.card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  border: 1px solid var(--line);
  box-shadow: 0 4px 20px rgba(51, 49, 50, 0.04);
  margin-bottom: 20px;
}
.alert {
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.55;
}
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}
input, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  margin-bottom: 16px;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

.ticket-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 12px;
  background: #fff;
}
.ticket-code {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--purple);
  margin-bottom: 4px;
}
.ticket-subject { font-size: 15px; font-weight: 700; color: var(--ink); }
.ticket-status { font-size: 12px; color: var(--muted); margin-top: 4px; }
.thread {
  margin-bottom: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.thread-you { background: var(--bg); }
.thread-support { background: var(--purple-pale); border-color: var(--purple-faint); }
.thread-meta { font-size: 11px; color: var(--muted); margin-bottom: 8px; font-weight: 600; }

.filter-pills { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-pill {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
  cursor: pointer;
  font-family: inherit;
}
.filter-pill.active,
.filter-pill:hover {
  border-color: var(--purple-faint);
  background: var(--purple-pale);
  color: var(--purple);
}

.invoice-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.invoice-table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid var(--line);
  color: var(--soft);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.invoice-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.status-paid {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: #ecfdf3;
  color: #166534;
}
.status-open {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--purple-pale);
  color: var(--purple-deep);
}
.empty-cell { color: var(--muted); padding: 28px 12px !important; line-height: 1.55; }
.back-link {
  display: inline-block;
  font-size: 13px;
  color: var(--purple-deep);
  font-weight: 600;
  margin-bottom: 16px;
}

a.canvas-launching { opacity: 0.72; cursor: wait; }

@media (max-width: 960px) {
  .layout {
    position: static;
    inset: auto;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    left: auto;
    bottom: 0;
    z-index: 200;
    width: min(288px, 88vw);
    max-width: 88vw;
    height: 100dvh;
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    transform: translateX(100%);
    transition: transform 0.22s ease-out;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
  body.hub-mobile-nav-open .layout .sidebar {
    transform: translateX(0);
  }
  body.hub-mobile-nav-open {
    overflow: hidden;
  }
  .hub-nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 199;
    background: rgba(26, 51, 86, 0.45);
  }
  body.hub-mobile-nav-open .hub-nav-backdrop {
    display: block;
  }
  .hub-shell-topbar {
    display: flex;
  }
  .hub-shell-topbar .hub-menu-btn svg,
  .hub-shell-topbar .hub-sidebar-show-btn svg {
    width: 20px;
    height: 20px;
  }
  .main {
    height: auto;
    min-height: 0;
    overflow: visible;
  }
  .page-banner {
    padding: 24px 20px 28px;
  }
  .page-banner h1 {
    font-size: clamp(24px, 6vw, 32px);
  }
  .page-body {
    padding: 20px 16px 48px;
    padding-bottom: max(48px, env(safe-area-inset-bottom));
  }
  .page-head {
    flex-direction: column;
    align-items: stretch;
  }
  .btn {
    width: 100%;
    min-height: 44px;
  }
  .page-head .btn {
    width: auto;
    align-self: flex-start;
  }
  .invoice-table {
    font-size: 13px;
  }
  .invoice-table th,
  .invoice-table td {
    padding: 10px 8px;
  }
  .ticket-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .course-card .course-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .course-card .course-actions .btn {
    width: 100%;
  }
}

@media (min-width: 961px) {
  .hub-shell-topbar {
    display: none;
  }
  .layout.layout--sidebar-hidden .hub-shell-topbar {
    display: flex;
  }
  .hub-nav-backdrop {
    display: none !important;
  }
}
