/* ============================================================
   KPBL Panel — Design System
   ============================================================ */

:root {
  --color-primary:        #5B5FE3;
  --color-primary-dark:   #4347C9;
  --color-primary-soft:   rgba(91, 95, 227, .08);
  --color-success:        #10B981;
  --color-warning:        #F59E0B;
  --color-danger:         #EF4444;
  --color-info:           #0EA5E9;
  --color-purple:         #8B5CF6;

  --color-text:           #1F2937;
  --color-text-soft:      #374151;
  --color-muted:          #6B7280;
  --color-muted-2:        #9CA3AF;
  --color-border:         #E5E7EB;
  --color-border-soft:    #F3F4F6;

  --color-bg:             #F4F5FA;
  --color-surface:        #FFFFFF;

  --color-sidebar:        #1F2335;
  --color-sidebar-2:      #181B2A;
  --color-sidebar-text:   #A5ADBF;
  --color-sidebar-hover:  #2A3049;
  --color-sidebar-active: #5B5FE3;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 6px 16px rgba(15, 23, 42, .08), 0 2px 4px rgba(15, 23, 42, .04);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

/* === Base === */

html, body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--color-primary);
  transition: color .15s;
}
a:hover, a:focus {
  color: var(--color-primary-dark);
  text-decoration: none;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--color-text);
  font-weight: 600;
}

hr {
  border-color: var(--color-border);
}

/* === Layout: flex shell === */

.app-body {
  display: flex;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

.app-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--color-sidebar);
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: transform .25s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}

.app-sidebar::-webkit-scrollbar { width: 6px; }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.app-burger {
  background: none;
  border: none;
  padding: 8px;
  border-radius: 6px;
  color: var(--color-text);
  cursor: pointer;
  display: none;
  line-height: 0;
}

.app-burger:hover { background: var(--color-border-soft); }
.app-burger .material-icons { font-size: 24px; }

.app-brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.2px;
}
.app-brand:hover { color: var(--color-primary); text-decoration: none; }
.app-brand span {
  font-size: 13px;
  font-weight: 400;
  color: var(--color-muted);
  margin-left: 4px;
}

.app-content {
  flex: 1;
  padding: 24px 28px 40px;
  min-width: 0;
}

.sidebar-overlay { display: none; }

@media (max-width: 991px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0, 0, 0, .15);
  }
  body.sidebar-open .app-sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    z-index: 90;
    cursor: pointer;
    border: none;
    padding: 0;
  }
  .app-burger { display: inline-flex; align-items: center; justify-content: center; }
  .app-content { padding: 16px; }
  .app-topbar { padding: 0 14px; }
}

/* === Sidebar nav === */

.sidebar-logo {
  padding: 22px 20px 18px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  margin-bottom: 6px;
}

.sidebar-logo img {
  max-height: 80px;
  width: auto;
  margin: 0 auto;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .25));
}

.sidebar-nav {
  padding: 0 0 20px;
}

.nav-section {
  padding: 16px 24px 6px;
  font-size: 10px;
  color: rgba(255, 255, 255, .35);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}

.sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-menu > li > a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-sidebar-text);
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .15s ease;
  text-decoration: none;
}

.sidebar-menu > li > a:hover,
.sidebar-menu > li > a:focus {
  background: var(--color-sidebar-hover);
  color: #fff;
  text-decoration: none;
}

.sidebar-menu > li > a.is-active {
  background: var(--color-sidebar-hover);
  color: #fff;
  border-left-color: var(--color-sidebar-active);
}

.sidebar-menu > li > a .material-icons {
  font-size: 20px;
  opacity: .9;
  flex-shrink: 0;
}

.sidebar-menu > li > a.logout {
  color: rgba(255, 100, 100, .8);
}
.sidebar-menu > li > a.logout:hover {
  background: rgba(239, 68, 68, .15);
  color: #FCA5A5;
  border-left-color: var(--color-danger);
}

/* === Page title block (formerly .wellcome) === */

.wellcome {
  color: var(--color-text);
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 22px;
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.wellcome small {
  font-size: 13px;
  font-weight: 400;
  color: var(--color-muted);
}

@media screen and (min-width: 0px) and (max-width: 991px) {
  .wellcome { font-size: 18px; }
}

/* === Panels (cards) === */

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.panel-heading {
  background: transparent !important;
  border-bottom: 1px solid var(--color-border);
  padding: 16px 20px;
  border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-primary);
  margin-left: auto;
  text-decoration: none;
}
.panel-link:hover { color: var(--color-primary-dark); }

.panel .panel-heading h3,
.panel .panel-heading .panel-title {
  color: var(--color-text) !important;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  margin: 0;
  flex: 1;
}

.panel-body {
  padding: 18px 20px;
}

.panel-footer {
  background: var(--color-border-soft);
  border-top: 1px solid var(--color-border);
  padding: 12px 20px;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* Colored panel top stripe */
.panel-primary { border-top: 3px solid var(--color-primary); }
.panel-info    { border-top: 3px solid var(--color-info); }
.panel-success { border-top: 3px solid var(--color-success); }
.panel-warning { border-top: 3px solid var(--color-warning); }
.panel-danger  { border-top: 3px solid var(--color-danger); }

/* === Tables === */

.table {
  margin-bottom: 0;
  background: transparent;
  width: 100%;
}

.table > thead > tr > th {
  border-bottom: 1px solid var(--color-border);
  border-top: none;
  background: var(--color-border-soft);
  color: var(--color-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 10px 14px;
  text-align: left;
  white-space: nowrap;
}

.table > tbody > tr > td {
  border-top: 1px solid var(--color-border);
  padding: 12px 14px;
  vertical-align: middle;
  text-align: left;
  font-size: 14px;
}

.table > tbody > tr:first-child > td {
  border-top: none;
}

.table-hover > tbody > tr:hover {
  background-color: var(--color-primary-soft);
}

.table-striped > tbody > tr:nth-of-type(odd) {
  background-color: transparent;
}
.table-striped > tbody > tr:nth-of-type(even) {
  background-color: var(--color-border-soft);
}

/* Responsive horizontal scroll for tables inside panels */
.table-responsive {
  border: none;
  margin: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.panel-body > .table-responsive,
.panel-body > .table {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* Action-buttons cell — compact column, right-aligned */
.row-actions {
  white-space: nowrap;
  text-align: right;
  width: 1%;
}
.row-actions .btn + .btn { margin-left: 6px; }

/* Clickable rows */
.table > tbody > tr.is-clickable { cursor: pointer; }

/* Panel-heading as a toolbar with title left, controls right */
.panel-heading .panel-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  order: -1;
}

.panel-heading .panel-toolbar .form-control {
  height: 30px;
  padding: 4px 10px;
  font-size: 12px;
  margin: 0;
  min-width: 180px;
  border-radius: 6px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.panel-heading .panel-toolbar .form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

/* Empty state inside panel-body (replacement for plain alert) */
.table-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  text-align: center;
  color: var(--color-muted);
}
.table-empty .material-icons {
  font-size: 48px;
  color: var(--color-muted-2);
  margin-bottom: 12px;
}
.table-empty .table-empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
}
.table-empty .table-empty-text {
  font-size: 13px;
  color: var(--color-muted);
  margin-bottom: 14px;
}

/* Panel footer with row count + pagination side-by-side */
.panel-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.panel-footer-bar .pagination { margin: 0; }
.panel-footer-bar .footer-hint {
  font-size: 12px;
  color: var(--color-muted);
}
.panel-footer-bar:has(.pagination:empty) { justify-content: flex-end; }

/* ============================================================
   Buttons — clean filled, no gradients, no lift, focus ring
   ============================================================ */

.btn,
input[type="submit"].btn,
input[type="button"].btn,
button.btn {
  /* per-variant tokens (overridden by .btn-* below) */
  --btn-bg: transparent;
  --btn-border: transparent;
  --btn-color: var(--color-text-soft);
  --btn-hover-bg: rgba(15, 23, 42, .08);
  --btn-hover-border: transparent;
  --btn-hover-color: var(--color-text);
  --btn-hover-shadow: none;
  --btn-active-bg: rgba(15, 23, 42, .14);
  --btn-ring: rgba(91, 95, 227, .3);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
  border-radius: 8px;
  border: 1px solid var(--btn-border);
  background-color: var(--btn-bg);
  color: var(--btn-color);
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  vertical-align: middle;
  white-space: nowrap;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, box-shadow .2s ease;
  position: relative;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  text-shadow: none;
  margin: 0;
}

.btn:hover {
  background-color: var(--btn-hover-bg);
  border-color: var(--btn-hover-border);
  color: var(--btn-hover-color);
  box-shadow: var(--btn-hover-shadow);
  text-decoration: none;
}

.btn:active {
  background-color: var(--btn-active-bg);
  box-shadow: none;
}

.btn:focus-visible {
  box-shadow: var(--btn-hover-shadow), 0 0 0 3px var(--btn-ring);
}

.btn[disabled],
.btn.disabled {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn .material-icons {
  font-size: 17px;
  line-height: 1;
  flex-shrink: 0;
}

/* --- Sizes --- */

.btn-xs {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 6px;
  gap: 5px;
}
.btn-xs .material-icons { font-size: 14px; }

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 7px;
  gap: 6px;
}
.btn-sm .material-icons { font-size: 15px; }

.btn-lg {
  padding: 12px 22px;
  font-size: 15px;
  border-radius: 10px;
  gap: 8px;
}
.btn-lg .material-icons { font-size: 20px; }

.btn-block {
  display: flex;
  width: 100%;
}

/* --- Variants (white background, colored border + text, fill on hover) --- */

.btn-primary,
.btn-primary.btn-raised {
  --btn-bg: #fff;
  --btn-border: var(--color-primary);
  --btn-color: var(--color-primary);
  --btn-hover-bg: var(--color-primary);
  --btn-hover-border: var(--color-primary);
  --btn-hover-color: #fff;
  --btn-hover-shadow: 0 6px 16px rgba(91, 95, 227, .25);
  --btn-active-bg: var(--color-primary-dark);
  --btn-ring: rgba(91, 95, 227, .35);
}

.btn-info,
.btn-info.btn-raised {
  --btn-bg: #fff;
  --btn-border: var(--color-info);
  --btn-color: var(--color-info);
  --btn-hover-bg: var(--color-info);
  --btn-hover-border: var(--color-info);
  --btn-hover-color: #fff;
  --btn-hover-shadow: 0 6px 16px rgba(14, 165, 233, .25);
  --btn-active-bg: #0284C7;
  --btn-ring: rgba(14, 165, 233, .35);
}

.btn-success,
.btn-success.btn-raised {
  --btn-bg: #fff;
  --btn-border: var(--color-success);
  --btn-color: var(--color-success);
  --btn-hover-bg: var(--color-success);
  --btn-hover-border: var(--color-success);
  --btn-hover-color: #fff;
  --btn-hover-shadow: 0 6px 16px rgba(16, 185, 129, .25);
  --btn-active-bg: #059669;
  --btn-ring: rgba(16, 185, 129, .35);
}

.btn-warning,
.btn-warning.btn-raised {
  --btn-bg: #fff;
  --btn-border: var(--color-warning);
  --btn-color: var(--color-warning);
  --btn-hover-bg: var(--color-warning);
  --btn-hover-border: var(--color-warning);
  --btn-hover-color: #fff;
  --btn-hover-shadow: 0 6px 16px rgba(245, 158, 11, .25);
  --btn-active-bg: #D97706;
  --btn-ring: rgba(245, 158, 11, .35);
}

.btn-danger,
.btn-danger.btn-raised {
  --btn-bg: #fff;
  --btn-border: var(--color-danger);
  --btn-color: var(--color-danger);
  --btn-hover-bg: var(--color-danger);
  --btn-hover-border: var(--color-danger);
  --btn-hover-color: #fff;
  --btn-hover-shadow: 0 6px 16px rgba(239, 68, 68, .25);
  --btn-active-bg: #DC2626;
  --btn-ring: rgba(239, 68, 68, .35);
}

/* --- Default (white with neutral border) --- */

.btn-default,
.btn-default.btn-raised {
  --btn-bg: #fff;
  --btn-border: var(--color-border);
  --btn-color: var(--color-text-soft);
  --btn-hover-bg: #fff;
  --btn-hover-border: var(--color-muted);
  --btn-hover-color: var(--color-text);
  --btn-hover-shadow: 0 4px 10px rgba(15, 23, 42, .08);
  --btn-active-bg: var(--color-border-soft);
  --btn-ring: rgba(107, 114, 128, .25);
}

/* --- Link (bare text) --- */

.btn-link {
  --btn-bg: transparent;
  --btn-border: transparent;
  --btn-color: var(--color-primary);
  --btn-hover-bg: transparent;
  --btn-hover-color: var(--color-primary-dark);
  --btn-active-bg: transparent;
  padding-left: 0;
  padding-right: 0;
  font-weight: 500;
}
.btn-link:hover { text-decoration: underline; }

/* --- Bootstrap-material ripple container (keep visible) --- */

.btn .ripple-container { border-radius: inherit; }
.ripple { background-color: rgba(15, 23, 42, .1) !important; }
.btn-primary .ripple { background-color: rgba(91, 95, 227, .2) !important; }
.btn-info    .ripple { background-color: rgba(14, 165, 233, .2) !important; }
.btn-success .ripple { background-color: rgba(16, 185, 129, .2) !important; }
.btn-warning .ripple { background-color: rgba(245, 158, 11, .2) !important; }
.btn-danger  .ripple { background-color: rgba(239, 68, 68, .2) !important; }
.btn-default .ripple { background-color: rgba(15, 23, 42, .08) !important; }
.btn-link    .ripple { background-color: rgba(91, 95, 227, .15) !important; }
.btn:hover .ripple,
.btn:active .ripple { background-color: rgba(255, 255, 255, .3) !important; }

/* === Labels / Badges === */

.label {
  font-weight: 500;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-block;
  letter-spacing: .3px;
}

.label-primary { background-color: var(--color-primary); }
.label-info    { background-color: var(--color-info); }
.label-success { background-color: var(--color-success); }
.label-warning { background-color: var(--color-warning); }
.label-danger  { background-color: var(--color-danger); }
.label-default { background-color: var(--color-muted); color: #fff; }

.badge {
  background-color: var(--color-muted);
  color: #fff;
  float: none;
  font-weight: 500;
}

/* === Forms === */

.form-control {
  border-color: var(--color-border);
  font-size: 14px;
}

.form-group .help-block {
  color: var(--color-muted-2);
  font-size: 12px;
}

/* === Alerts === */

.alert {
  border-radius: var(--radius-sm);
  border: none;
  padding: 14px 18px;
  font-size: 14px;
}
.alert h4 { margin-top: 0; font-weight: 600; }
.alert p:last-child { margin-bottom: 0; }
.alert-success { background-color: #ECFDF5; color: #065F46; }
.alert-info    { background-color: #E0F2FE; color: #075985; }
.alert-warning { background-color: #FEF3C7; color: #92400E; }
.alert-danger  { background-color: #FEE2E2; color: #991B1B; }

/* === Pagination === */

.pagination {
  margin: 16px 0;
}
.pagination > li > a, .pagination > li > span {
  color: var(--color-text);
  border-color: var(--color-border);
}
.pagination > .active > a, .pagination > .active > span {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

/* === Confirmation popover (kept from original) === */

.confirmation {
  box-shadow: 0 8px 17px 0 rgba(0, 0, 0, .2), 0 6px 20px 0 rgba(0, 0, 0, .19)
}
.confirmation .popover-title {
  background-color: rgba(0, 0, 0, 0);
}

/* ============================================================
   KPI cards (dashboard / stat)
   ============================================================ */

.dashboard-kpi {
  margin-bottom: 10px;
}

.kpi-card {
  display: flex;
  align-items: center;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  background-color: #fff;
  margin-bottom: 20px;
  min-height: 96px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: transform .2s, box-shadow .2s;
}
.kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.kpi-card .kpi-icon {
  margin-right: 16px;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, .25);
  color: #fff;
  flex-shrink: 0;
}

.kpi-card .kpi-icon .material-icons {
  font-size: 28px;
}

.kpi-card .kpi-meta {
  flex: 1;
  min-width: 0;
  color: #fff;
}

.kpi-card .kpi-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  opacity: .85;
  font-weight: 500;
}

.kpi-card .kpi-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.15;
  margin: 2px 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-card .kpi-currency {
  font-size: 16px;
  font-weight: 400;
  opacity: .85;
}

.kpi-card .kpi-sub {
  font-size: 12px;
  opacity: .85;
}

.kpi-card .kpi-sub a {
  color: #fff;
  text-decoration: underline;
}

.kpi-card-users    { background: linear-gradient(135deg, #6366F1 0%, #818CF8 100%); }
.kpi-card-services { background: linear-gradient(135deg, #10B981 0%, #34D399 100%); }
.kpi-card-tickets  { background: linear-gradient(135deg, #F59E0B 0%, #FBBF24 100%); }
.kpi-card-revenue  { background: linear-gradient(135deg, #8B5CF6 0%, #A78BFA 100%); }

.kpi-card-mini {
  background: linear-gradient(135deg, #475569 0%, #64748B 100%);
  min-height: 84px;
  padding: 14px 18px;
}

.kpi-card-mini .kpi-icon {
  width: 46px;
  height: 46px;
}

.kpi-card-mini .kpi-icon .material-icons {
  font-size: 24px;
}

.kpi-card-mini .kpi-value {
  font-size: 22px;
}

@media (max-width: 767px) {
  .kpi-card .kpi-value { font-size: 22px; }
  .kpi-card .kpi-icon { width: 46px; height: 46px; margin-right: 12px; }
  .kpi-card .kpi-icon .material-icons { font-size: 24px; }
}

/* ============================================================
   Order flow
   ============================================================ */

.order-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0 30px;
  flex-wrap: wrap;
}

.order-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 110px;
  padding: 0 5px;
}

.order-step-num {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--color-border);
  color: var(--color-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.order-step.active .order-step-num {
  background: linear-gradient(135deg, var(--color-primary) 0%, #818CF8 100%);
  color: #fff;
  box-shadow: 0 0 0 6px var(--color-primary-soft);
}

.order-step.done .order-step-num {
  background: var(--color-success);
  color: #fff;
}

.order-step-label {
  font-size: 12px;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.order-step.active .order-step-label,
.order-step.done .order-step-label {
  color: var(--color-text);
  font-weight: 600;
}

.order-step-line {
  flex: 0 1 80px;
  height: 2px;
  background: var(--color-border);
  margin: 0 -10px 22px;
}

.order-step.done + .order-step-line {
  background: var(--color-success);
}

/* Plan cards */
.plan-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
  box-shadow: var(--shadow-sm);
}

.plan-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.plan-card-header {
  background: linear-gradient(135deg, var(--color-primary) 0%, #818CF8 100%);
  color: #fff;
  padding: 20px;
  text-align: center;
}

.plan-card-header.vds {
  background: linear-gradient(135deg, #10B981 0%, #34D399 100%);
}

.plan-card-name {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.plan-card-body {
  padding: 24px 20px 16px;
  text-align: center;
}

.plan-card-price {
  font-size: 36px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
}

.plan-card-currency {
  font-size: 16px;
  font-weight: 400;
  color: var(--color-muted);
}

.plan-card-period {
  color: var(--color-muted-2);
  font-size: 13px;
  margin-top: 4px;
}

.plan-card-action {
  padding: 0 20px 20px;
}

/* Period radio cards */
.period-card-label {
  display: block;
  cursor: pointer;
  font-weight: normal;
  margin: 0 0 15px 0;
  position: relative;
}

.period-card-label input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.period-card {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px 10px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: all .2s;
  position: relative;
}

.period-card-discount {
  position: absolute;
  top: -8px;
  right: -8px;
  background: linear-gradient(135deg, #F59E0B 0%, #FBBF24 100%);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(245, 158, 11, .4);
  letter-spacing: .3px;
}

.period-card-label:hover .period-card {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-muted-2);
}

.period-card-label input:checked + .period-card {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  box-shadow: 0 4px 14px rgba(91, 95, 227, .2);
}

.period-card-label input:checked + .period-card .period-card-num {
  color: var(--color-primary-dark);
}

.period-card-num {
  font-size: 32px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
}

.period-card-name {
  font-size: 11px;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 6px 0 10px;
}

.period-card-amount {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

/* Order summary */
.order-summary-card {
  background: linear-gradient(135deg, #1F2335 0%, #2A3049 100%);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 22px 24px;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 20px;
}

.order-summary-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  opacity: .85;
  margin-bottom: 14px;
}

.order-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  font-size: 13px;
}

.order-summary-row:last-of-type {
  border-bottom: none;
}

.order-summary-row .order-summary-value {
  font-weight: 600;
  text-align: right;
  margin-left: 12px;
}

.order-summary-total {
  margin-top: 12px;
  padding-top: 16px;
  border-top: 2px solid rgba(255, 255, 255, .25);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 18px;
  font-weight: 700;
}

.order-form-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.order-form-title {
  margin: 0 0 18px;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
}

/* ============================================================
   Auth pages (login / register / reset)
   ============================================================ */

.auth-page {
  background: linear-gradient(135deg, #1F2335 0%, #5B5FE3 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-family: 'Roboto', sans-serif;
}

.auth-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
  padding: 36px 36px 28px;
  width: 100%;
  max-width: 430px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo img {
  max-width: 160px;
  height: auto;
}

.auth-title {
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 24px;
}

.auth-card .form-group {
  margin-bottom: 18px;
}

.auth-card .btn-block {
  margin-top: 6px;
}

.auth-card .nav-tabs {
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 20px;
}

.auth-card .nav-tabs > li > a {
  border: none;
  color: var(--color-muted);
  font-weight: 500;
  padding: 10px 14px;
}

.auth-card .nav-tabs > li.active > a {
  color: var(--color-primary);
  border: none;
  background: transparent;
  border-bottom: 2px solid var(--color-primary);
}

.auth-footer {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--color-muted);
}

.auth-footer a {
  color: var(--color-primary);
}

/* ============================================================
   Quick action buttons (admin dashboard)
   ============================================================ */
.quick-actions .btn-block {
  margin-bottom: 10px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
}
.quick-actions .btn-block:last-child { margin-bottom: 0; }
.quick-actions .btn-block .material-icons {
  font-size: 18px;
}

/* ============================================================
   Payment system cards
   ============================================================ */
.paysystem-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.paysystem-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--paysystem-color, var(--color-primary));
}
.paysystem-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 36px -18px rgba(15, 23, 42, .25),
              0 8px 16px -10px var(--paysystem-color, rgba(91, 95, 227, .35));
  border-color: transparent;
}
.paysystem-header {
  padding: 18px 20px 6px;
  color: var(--color-text);
  background: transparent;
}
.paysystem-title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--color-muted) !important;
  text-align: center !important;
}
.paysystem-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: 6px 22px 22px;
}
.paysystem-logo {
  text-align: center;
  margin-bottom: 18px;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-border-soft) 100%);
  border-radius: var(--radius-md);
}
.paysystem-logo img {
  max-width: 72%;
  max-height: 96px;
  filter: drop-shadow(0 2px 6px rgba(15, 23, 42, .08));
}
.paysystem-body form {
  margin-top: auto;
}
.paysystem-body .btn[name="pay"] {
  width: 100%;
  padding: 11px 14px;
  font-weight: 600;
  letter-spacing: .2px;
  border-radius: var(--radius-md);
  background: var(--paysystem-color, var(--color-primary));
  border-color: var(--paysystem-color, var(--color-primary));
  box-shadow: 0 8px 18px -10px var(--paysystem-color, rgba(91, 95, 227, .5));
  transition: transform .15s ease, box-shadow .25s ease, filter .15s ease;
}
.paysystem-body .btn[name="pay"]:hover,
.paysystem-body .btn[name="pay"]:focus {
  background: var(--paysystem-color, var(--color-primary));
  border-color: var(--paysystem-color, var(--color-primary));
  filter: brightness(1.08);
  box-shadow: 0 12px 22px -10px var(--paysystem-color, rgba(91, 95, 227, .6));
}
.paysystem-body .btn[name="pay"]:active {
  transform: translateY(1px);
  filter: brightness(.95);
}
@media (max-width: 480px) {
  .paysystem-logo { min-height: 96px; padding: 10px; }
  .paysystem-logo img { max-height: 80px; }
}

/* ============================================================
   Checkout page
   ============================================================ */
.checkout-page {
  max-width: 1100px;
}

.checkout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.checkout-header-eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--color-muted);
  margin-bottom: 2px;
}
.checkout-header-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
}
.checkout-back .material-icons {
  font-size: 16px;
  vertical-align: middle;
  margin-right: 2px;
}

.checkout-summary {
  position: relative;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 26px 30px;
  margin-bottom: 28px;
  color: #fff;
  background: linear-gradient(135deg, #5B5FE3 0%, #8B5CF6 55%, #EC4899 100%);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 40px -18px rgba(91, 95, 227, .55);
  overflow: hidden;
}
.checkout-summary-shape {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  pointer-events: none;
}
.checkout-summary-shape-1 {
  top: -60px;
  right: -40px;
  width: 220px;
  height: 220px;
}
.checkout-summary-shape-2 {
  bottom: -70px;
  right: 120px;
  width: 140px;
  height: 140px;
  background: rgba(255, 255, 255, .06);
}
.checkout-summary-icon {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 16px;
  backdrop-filter: blur(6px);
}
.checkout-summary-icon .material-icons {
  font-size: 30px;
  color: #fff;
}
.checkout-summary-body {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-width: 0;
}
.checkout-summary-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  opacity: .85;
  margin-bottom: 6px;
}
.checkout-summary-amount {
  font-size: 38px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.5px;
}
.checkout-summary-currency {
  font-size: 20px;
  font-weight: 500;
  opacity: .85;
  margin-left: 8px;
}
.checkout-summary-hint {
  font-size: 13px;
  opacity: .85;
  margin-top: 10px;
}
.checkout-summary-badge {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #fff;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 999px;
}
.checkout-summary-badge .material-icons {
  font-size: 16px;
}

.checkout-section {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.checkout-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
}
.checkout-section-hint {
  font-size: 12px;
  color: var(--color-muted);
}

@media (max-width: 767px) {
  .checkout-summary {
    flex-wrap: wrap;
    padding: 22px;
    gap: 16px;
  }
  .checkout-summary-amount { font-size: 30px; }
  .checkout-summary-badge { order: 3; }
  .checkout-section { flex-direction: column; align-items: flex-start; gap: 4px; }
}
@media (max-width: 480px) {
  .checkout-summary-icon { width: 52px; height: 52px; border-radius: 12px; }
  .checkout-summary-icon .material-icons { font-size: 26px; }
  .checkout-summary-amount { font-size: 26px; }
}

/* ============================================================
   Support ticket thread
   ============================================================ */
.ticket-thread {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}
.ticket-msg {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  max-width: 70%;
  box-shadow: var(--shadow-sm);
}
.ticket-msg-client {
  align-self: flex-start;
  border-left: 3px solid var(--color-warning);
}
.ticket-msg-agent {
  align-self: flex-end;
  border-left: 3px solid var(--color-success);
}
.ticket-msg-author {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: .3px;
  margin-bottom: 6px;
}
.ticket-msg-body {
  color: var(--color-text);
  line-height: 1.5;
  word-wrap: break-word;
}
.ticket-msg-time {
  font-size: 11px;
  color: var(--color-muted-2);
  margin-top: 6px;
  text-align: right;
}

@media (max-width: 767px) {
  .ticket-msg { max-width: 90%; }
}

/* ============================================================
   Misc tweaks
   ============================================================ */
.panel .panel-heading .panel-title .material-icons {
  vertical-align: middle;
  font-size: 18px;
  color: var(--color-muted);
}

/* Tooltips fix when title overflows */
.panel .panel-heading h3.panel-title { line-height: 1.4; }

/* Material design floating labels don't conflict with table inputs */
.table .form-group { margin-bottom: 0; }
.table .form-control { background: transparent; }

/* ============================================================
   Document view (счёт / акт / счёт-фактура — карточка просмотра)
   ============================================================ */
.docview { overflow: hidden; }

.docview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 20px;
  background: linear-gradient(135deg, var(--color-primary-soft), transparent 72%);
  border-bottom: 1px solid var(--color-border);
}
.docview-head-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.docview-icon {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}
.docview-icon .material-icons { font-size: 26px; color: #fff; }
.docview-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.2;
}
.docview-sub {
  font-size: 13px;
  color: var(--color-muted);
  margin-top: 2px;
}
.docview-actions { display: flex; gap: 8px; flex: none; }

.docview-body { padding: 20px; }

.docview-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.docview-party {
  background: var(--color-border-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
}
.docview-party-h {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--color-muted);
  margin-bottom: 8px;
}
.docview-org {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 12px;
}
.docview-req {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 14px;
  margin: 0;
  font-size: 13px;
}
.docview-req dt {
  color: var(--color-muted-2);
  font-weight: 500;
  white-space: nowrap;
}
.docview-req dd {
  margin: 0;
  color: var(--color-text-soft);
  word-break: break-word;
}
.docview-req dd:empty::before {
  content: "—";
  color: var(--color-muted-2);
}

.docview-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 18px;
  padding: 18px 20px;
  background: var(--color-primary-soft);
  border: 1px solid rgba(91, 95, 227, .18);
  border-radius: var(--radius-md);
}
.docview-sum-label {
  display: block;
  font-size: 12px;
  color: var(--color-muted);
  margin-bottom: 3px;
}
.docview-sum-amount {
  font-size: 26px;
  font-weight: 700;
  color: var(--color-primary-dark);
  line-height: 1.1;
}
.docview-sum-side {
  display: flex;
  gap: 28px;
}
.docview-sum-side > div { text-align: right; }
.docview-sum-side span {
  display: block;
  font-size: 12px;
  color: var(--color-muted);
  margin-bottom: 3px;
}
.docview-sum-side b {
  font-size: 15px;
  color: var(--color-text);
}

.docview-foot {
  margin-top: 16px;
  font-size: 13px;
  color: var(--color-text-soft);
}
.docview-foot > div + div { margin-top: 6px; }
.docview-foot-label { color: var(--color-muted); margin-right: 4px; }

@media (max-width: 767px) {
  .docview-parties { grid-template-columns: 1fr; }
  .docview-summary { flex-direction: column; align-items: flex-start; }
  .docview-sum-side { width: 100%; justify-content: space-between; gap: 16px; }
  .docview-sum-side > div { text-align: left; }
}
