/*
  LinePro management console visual layer.
  This file only changes presentation; API bindings and business flows stay in app.js.
*/
:root {
  --console-accent: #5746e9;
  --console-accent-strong: #4338ca;
  --console-accent-soft: #f1efff;
  --console-cyan: #0891b2;
  --console-green: #059669;
  --console-amber: #d97706;
  --console-ink: #172033;
  --console-muted: #718096;
  --console-canvas: #f5f7fb;
  --console-border: #e3e8f1;
  --console-shadow: 0 10px 28px rgba(32, 45, 72, .07);
  --console-shadow-hover: 0 16px 38px rgba(49, 46, 129, .11);
}

body {
  color: var(--console-ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(99, 102, 241, .08), transparent 22rem),
    radial-gradient(circle at 92% 5%, rgba(14, 165, 233, .06), transparent 24rem),
    var(--console-canvas);
}

button {
  min-height: 38px;
  border-color: #dce3ed;
  border-radius: 12px;
  padding-inline: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  font-weight: 650;
}

button:hover {
  border-color: #c4bfff;
  background: #f7f6ff;
  color: var(--console-accent-strong);
  box-shadow: 0 5px 14px rgba(79, 70, 229, .09);
}

button.primary,
button.blue {
  border-color: transparent;
  background: linear-gradient(135deg, #6655ed, #4f46e5);
  box-shadow: 0 8px 18px rgba(79, 70, 229, .22);
}

button.primary:hover,
button.blue:hover {
  border-color: transparent;
  background: linear-gradient(135deg, #5746e9, #4338ca);
  box-shadow: 0 10px 22px rgba(67, 56, 202, .28);
}

button.small {
  min-height: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 12px;
}

.app {
  grid-template-columns: 272px minmax(0, 1fr);
  background: transparent;
}

aside {
  height: 100vh;
  overflow: auto;
  border-right: 1px solid rgba(226, 232, 240, .9);
  padding: 20px 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(248, 250, 252, .98));
  box-shadow: 8px 0 28px rgba(32, 45, 72, .035);
}

aside .brand {
  height: auto;
  gap: 12px;
  margin: 0 0 17px;
  border: 0;
  border-radius: 18px;
  padding: 9px 10px 15px;
}

aside .brand .mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, #6d5af1, #4f46e5);
  color: #fff;
  box-shadow: 0 10px 24px rgba(79, 70, 229, .25);
}

aside .brand strong {
  color: #172033;
  font-size: 17px;
  letter-spacing: -.01em;
}

aside .brand span {
  color: #8490a5;
  font-size: 11px;
}

nav {
  display: grid;
  gap: 17px;
  padding-bottom: 104px;
}

.nav-group {
  display: grid;
  gap: 6px;
}

.nav-group-title {
  padding: 0 11px;
  color: #a0a9b8;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .13em;
}

.nav-group-items {
  display: grid;
  gap: 5px;
}

nav button {
  width: 100%;
  min-height: 42px;
  height: 42px;
  position: relative;
  justify-content: flex-start;
  gap: 11px;
  border-radius: 13px;
  padding: 0 12px;
  color: #5f6b7d;
  font-weight: 650;
  box-shadow: none;
}

nav button .nav-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 7px;
}

nav button:hover {
  border-color: transparent;
  background: #f0efff;
  color: #4f46e5;
  box-shadow: none;
}

nav button.active {
  border-color: #dedaff;
  background: linear-gradient(135deg, #efedff, #f6f5ff);
  color: #4338ca;
  box-shadow: inset 0 0 0 1px rgba(99, 102, 241, .04), 0 7px 18px rgba(79, 70, 229, .08);
}

nav button.active::before {
  content: "";
  width: 3px;
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: -5px;
  border-radius: 999px;
  background: #635bdf;
  box-shadow: 0 0 10px rgba(99, 91, 223, .35);
}

.aside-foot {
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: 10px;
  left: 16px;
  right: 16px;
  bottom: 16px;
  border-color: #e2e8f0;
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, .95);
  color: #64748b;
  box-shadow: 0 8px 22px rgba(32, 45, 72, .06);
}

.aside-foot > div {
  min-width: 0;
}

.aside-foot span,
.aside-foot strong {
  display: block;
}

.aside-foot span {
  color: #8b96a8;
  font-size: 10px;
  font-weight: 700;
}

.aside-foot strong {
  margin-top: 3px;
  overflow: hidden;
  color: #475569;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runtime-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border: 3px solid #d1fae5;
  border-radius: 999px;
  background: #10b981;
  box-sizing: content-box;
}

.main {
  grid-template-rows: 76px minmax(0, 1fr);
}

header {
  height: 76px;
  border-bottom-color: rgba(226, 232, 240, .85);
  padding: 0 28px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .7);
  backdrop-filter: blur(18px);
}

.header-title h1 {
  color: #172033;
  font-size: 20px;
  letter-spacing: -.02em;
}

.header-title span {
  color: #8994a6;
  font-size: 11px;
}

.toolbar {
  gap: 7px;
}

.toolbar .ghost {
  border-color: transparent;
  color: #68758a;
}

.toolbar .ghost:hover {
  border-color: #e5e7eb;
  background: #fff;
}

.user-pill {
  min-height: 38px;
  gap: 8px;
  border-color: #e1e6ef;
  border-radius: 12px;
  padding: 0 12px;
  background: rgba(255, 255, 255, .9);
  color: #475569;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .035);
  font-weight: 650;
}

.user-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #10b981;
  box-shadow: 0 0 0 3px #d1fae5;
}

main {
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: 28px 30px 50px;
}

.section-head {
  min-height: 112px;
  position: relative;
  align-items: flex-end;
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid #e2e4fb;
  border-radius: 22px;
  padding: 23px 25px;
  background:
    radial-gradient(circle at 88% 10%, rgba(99, 102, 241, .14), transparent 16rem),
    linear-gradient(135deg, #fff, #f6f5ff);
  box-shadow: 0 10px 30px rgba(49, 46, 129, .065);
}

.section-head::after {
  content: "";
  width: 44px;
  height: 4px;
  position: absolute;
  top: 22px;
  left: 25px;
  border-radius: 999px;
  background: linear-gradient(90deg, #635bdf, #a78bfa);
  box-shadow: 0 4px 12px rgba(99, 91, 223, .2);
}

.section-head > div {
  position: relative;
  z-index: 1;
}

.section-head h2 {
  margin-top: 13px;
  color: #172033;
  font-size: 24px;
  letter-spacing: -.025em;
}

.section-head p {
  max-width: 820px;
  margin-top: 7px;
  color: #718096;
  font-size: 13px;
  line-height: 1.65;
}

.section-head > button,
.section-head > .actions {
  position: relative;
  z-index: 1;
}

.stats {
  gap: 14px;
  margin-bottom: 20px;
}

.metric {
  min-height: 128px;
  position: relative;
  overflow: hidden;
  border-color: var(--console-border);
  border-radius: 19px;
  padding: 18px 19px;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--console-shadow);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.metric::after {
  content: "";
  width: 90px;
  height: 90px;
  position: absolute;
  top: -54px;
  right: -35px;
  border-radius: 999px;
  background: rgba(99, 102, 241, .08);
}

.metric:hover {
  border-color: #d9d4ff;
  box-shadow: var(--console-shadow-hover);
  transform: translateY(-2px);
}

.metric .meta {
  color: #758195;
  font-weight: 700;
}

.metric .meta .badge {
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 0;
  background: #eeecff;
  color: #5746e9;
}

.metric:nth-child(2) .meta .badge {
  background: #e8f8fc;
  color: var(--console-cyan);
}

.metric:nth-child(3) .meta .badge {
  background: #eafaf3;
  color: var(--console-green);
}

.metric:nth-child(4) .meta .badge {
  background: #fff6e8;
  color: var(--console-amber);
}

.metric strong {
  margin-top: 14px;
  color: #172033;
  font-size: 34px;
  letter-spacing: -.04em;
}

.metric .trend {
  margin-top: 9px;
  color: #9aa4b5;
}

.panel {
  border-color: var(--console-border);
  border-radius: 20px;
  margin-bottom: 18px;
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--console-shadow);
}

.panel-title {
  min-height: 64px;
  border-bottom-color: #edf0f5;
  padding: 15px 19px;
  background: linear-gradient(180deg, #fff, #fcfdff);
}

.panel-title > div:first-child,
.panel-title > h3:first-child {
  position: relative;
}

.panel-title h3 {
  color: #273247;
  font-size: 14px;
  letter-spacing: -.01em;
}

.panel-title span {
  display: block;
  margin-top: 4px;
  color: #8994a6;
  font-size: 11px;
  line-height: 1.5;
}

.cards-grid {
  gap: 14px;
  padding: 17px;
}

.data-card {
  border-color: #e5eaf2;
  border-radius: 17px;
  padding: 16px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(32, 45, 72, .04);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.data-card:hover {
  border-color: #d5d0ff;
  background: #fff;
  box-shadow: 0 12px 28px rgba(49, 46, 129, .09);
  transform: translateY(-2px);
}

.card-head {
  margin-bottom: 13px;
}

.card-title strong {
  color: #273247;
  font-size: 14px;
}

.card-title span {
  color: #8b96a8;
  font-size: 11px;
}

.card-fields {
  gap: 9px;
}

.card-field {
  min-height: 58px;
  border: 0;
  border-radius: 11px;
  padding: 9px 10px;
  background: #f7f9fc;
}

.card-field span {
  color: #96a0b0;
  font-size: 10px;
  font-weight: 750;
}

.card-field strong {
  color: #475569;
  font-size: 12px;
}

.card-actions {
  margin-top: 14px;
  border-top-color: #edf0f5;
  padding-top: 13px;
}

.pager {
  min-height: 52px;
  border-top-color: #edf0f5;
  padding: 10px 17px;
  background: #fafbfe;
}

form {
  gap: 14px;
  padding: 18px;
}

label {
  gap: 7px;
  color: #667389;
  font-size: 11px;
  font-weight: 700;
}

input,
select {
  height: 40px;
  border-color: #d7dee9;
  border-radius: 11px;
  padding-inline: 11px;
  color: #273247;
  background: #fff;
}

textarea {
  border-color: #d7dee9;
  border-radius: 11px;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #c5cfdd;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #8b80ee;
  box-shadow: 0 0 0 4px rgba(99, 91, 223, .12);
}

.xray-config-block,
.permission-resource-panel,
.protocol-card,
.entry-form-card,
.advanced-box,
.advanced-card {
  border-color: #e4e9f1;
  border-radius: 16px;
  box-shadow: 0 3px 12px rgba(32, 45, 72, .035);
}

.xray-config-block-head,
.permission-resource-head {
  border-bottom-color: #e9edf4;
  background: #fafbfe;
}

.xray-gateway-card {
  border-color: #e5eaf2;
  border-radius: 15px;
  box-shadow: 0 3px 12px rgba(32, 45, 72, .035);
}

.tunnel-binding-picker {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 7px;
}

.field-label {
  color: #667389;
  font-size: 11px;
  font-weight: 700;
}

.binding-picker-trigger {
  width: 100%;
  min-width: 0;
  justify-content: space-between;
  border-color: #d7dee9;
  background: #fff;
  color: #475569;
  font-weight: 600;
  text-align: left;
}

.binding-picker-trigger > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.binding-picker-chips {
  min-height: 25px;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.binding-picker-empty {
  color: #9aa4b5;
  font-size: 11px;
  font-weight: 500;
}

.tunnel-binding-modal-panel {
  margin-top: 14px;
}

.tunnel-binding-modal-panel .permission-option {
  align-items: center;
}

.tunnel-binding-modal-panel .permission-option > .badge {
  margin-left: auto;
}

.modal-action-spacer {
  flex: 1 1 auto;
}

.table-wrap {
  scrollbar-color: #cbd5e1 transparent;
}

table {
  color: #475569;
  background: transparent;
}

th,
td {
  border-bottom-color: #edf0f5;
  padding: 13px 14px;
  font-size: 12px;
}

th {
  color: #5f6b7d;
  background: #f8f9fc;
  font-size: 11px;
  letter-spacing: .01em;
}

tbody tr {
  transition: background .14s ease;
}

tbody tr:hover {
  background: #faf9ff;
}

.badge {
  min-height: 25px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 750;
}

.modal {
  background: rgba(22, 30, 48, .48);
  backdrop-filter: blur(7px);
}

.modal-card {
  border-color: rgba(226, 232, 240, .9);
  border-radius: 22px;
  box-shadow: 0 30px 90px rgba(15, 23, 42, .28);
}

.modal-head {
  min-height: 72px;
  align-items: center;
  border-bottom-color: #edf0f5;
  padding: 18px 22px;
  background: linear-gradient(135deg, #fff, #f8f7ff);
}

.modal-actions {
  border-top-color: #edf0f5;
  background: rgba(255, 255, 255, .97);
}

.auth-card {
  border-color: #e1e4f5;
  border-radius: 24px;
  box-shadow: 0 24px 70px rgba(49, 46, 129, .14);
}

.auth-card .brand {
  padding: 22px;
  background: linear-gradient(135deg, #fff, #f5f3ff);
}

.auth-card .mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  color: #fff;
}

.auth-card form {
  padding: 22px;
}

@media (min-width: 1680px) {
  .stats {
    grid-template-columns: repeat(4, minmax(220px, 1fr));
  }

  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  }
}

@media (max-width: 1100px) {
  .app {
    grid-template-columns: 1fr;
  }

  aside {
    height: auto;
    overflow: visible;
    padding: 12px 14px;
  }

  aside .brand {
    margin-bottom: 8px;
    padding: 5px 4px 10px;
  }

  nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 0 0 4px;
  }

  .nav-group {
    display: contents;
  }

  .nav-group-title {
    display: none;
  }

  .nav-group-items {
    display: flex;
    gap: 6px;
  }

  nav button {
    width: auto;
    min-width: 118px;
  }

  nav button.active::before {
    top: auto;
    right: 18px;
    bottom: -3px;
    left: 18px;
    width: auto;
    height: 3px;
  }

  header {
    min-height: 70px;
    padding: 13px 18px;
  }

  main {
    max-width: none;
    padding: 20px 18px 40px;
  }
}

@media (max-width: 720px) {
  header {
    gap: 12px;
  }

  .toolbar .user-pill {
    display: none;
  }

  .section-head {
    min-height: 132px;
    display: grid;
    align-items: end;
    padding: 21px 19px;
  }

  .section-head::after {
    top: 20px;
    left: 19px;
  }

  .section-head h2 {
    font-size: 21px;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    min-height: 116px;
    padding: 15px;
  }

  .metric strong {
    font-size: 29px;
  }
}

@media (max-width: 480px) {
  .toolbar .ghost {
    width: 38px;
    overflow: hidden;
    padding: 0;
    font-size: 0;
  }

  .toolbar .ghost .nav-icon {
    width: 18px;
    margin: 0;
  }

  main {
    padding-inline: 12px;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .panel,
  .section-head {
    border-radius: 17px;
  }
}
