﻿:root {
  --bg: #eef3ed;
  --bg-deep: #10231e;
  --card: rgba(255, 255, 250, 0.92);
  --card-solid: #fffffb;
  --text: #14221d;
  --muted: #6a756f;
  --line: rgba(20, 34, 29, 0.12);
  --brand: #1f8f68;
  --brand-2: #0f5e4a;
  --gold: #d8b15f;
  --danger: #c84b45;
  --danger-bg: #fff0ee;
  --ok: #1f8f68;
  --ok-bg: #e9f8ef;
  --warn: #b7791f;
  --shadow: 0 24px 70px rgba(20, 34, 29, 0.14);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  font-family: "Manrope", "Aptos", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(31, 143, 104, 0.22), transparent 30%),
    radial-gradient(circle at 92% 12%, rgba(216, 177, 95, 0.22), transparent 26%),
    linear-gradient(145deg, #f7f3e7 0%, #edf5ee 42%, #dce9df 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(16, 35, 30, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 35, 30, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 76%);
}

button, input, textarea { font: inherit; }

button {
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, opacity .18s ease;
}

button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }

input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  color: var(--text);
  background: rgba(255,255,255,.86);
  outline: none;
  transition: border .18s ease, box-shadow .18s ease, background .18s ease;
}

input:focus, textarea:focus {
  border-color: rgba(31,143,104,.7);
  box-shadow: 0 0 0 4px rgba(31,143,104,.12);
  background: #fff;
}

label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.wrap, .app-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.app-shell { padding: 22px 0 34px; }

.card, .login-card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,.72);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.login-page {
  display: grid;
  place-items: center;
  overflow: hidden;
}

.login-orb {
  position: fixed;
  width: 360px;
  height: 360px;
  border-radius: 999px;
  filter: blur(18px);
  opacity: .45;
  pointer-events: none;
}

.login-orb-a { left: -120px; top: -80px; background: #1f8f68; }
.login-orb-b { right: -120px; bottom: -120px; background: #d8b15f; }

.login-card {
  max-width: 460px;
  margin: 42px auto;
  padding: 34px;
  animation: rise .42s ease both;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 16px;
  border-radius: 18px;
  background: linear-gradient(145deg, #173a31, #1f8f68);
  box-shadow: 0 16px 30px rgba(31, 143, 104, .25);
  font-size: 27px;
}

h1, h2 { margin: 0; letter-spacing: -.04em; }
h1 { font-size: clamp(30px, 5vw, 54px); line-height: .95; }
h2 { font-size: 24px; }

.meta, p.meta, .hero-sub {
  color: var(--muted);
  margin: 8px 0 0;
}

.login-card form, .create-section form, .extend-form { display: grid; gap: 12px; }

.login-card button, .create-section button[type="submit"] {
  width: 100%;
  padding: 14px 18px;
  color: white;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 14px 26px rgba(31,143,104,.24);
}

.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  min-height: 230px;
  padding: 34px;
  border-radius: 36px;
  color: #f8fff9;
  background:
    radial-gradient(circle at 82% 28%, rgba(216,177,95,.42), transparent 23%),
    linear-gradient(135deg, #10231e 0%, #173a31 52%, #1f8f68 120%);
  box-shadow: 0 28px 80px rgba(16,35,30,.24);
  animation: rise .36s ease both;
}

.hero::after {
  content: "";
  position: absolute;
  right: 28px;
  bottom: -80px;
  width: 280px;
  height: 280px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  box-shadow: inset 0 0 0 42px rgba(255,255,255,.035);
}

.hero > * { position: relative; z-index: 1; }
.hero .hero-sub { max-width: 590px; color: rgba(248,255,249,.76); font-size: 16px; }
.eyebrow { color: var(--gold); font-size: 12px; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; margin-bottom: 12px; }

.btn-logout {
  width: auto;
  padding: 11px 16px;
  color: #173a31;
  background: #fff8df;
  box-shadow: 0 12px 28px rgba(0,0,0,.12);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: -54px;
  padding: 0 22px;
  position: relative;
  z-index: 2;
}

.stat-card {
  min-height: 126px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 24px;
  background: rgba(255,255,250,.9);
  box-shadow: 0 18px 48px rgba(20,34,29,.12);
}

.stat-card span, .stat-card small { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.stat-card strong { display: block; margin: 10px 0 6px; font-size: clamp(24px, 3vw, 36px); letter-spacing: -.05em; }
.stat-card.accent { background: linear-gradient(145deg, #f3fff6, #fffefa); border-color: rgba(31,143,104,.26); }
.stat-card.warn { border-color: rgba(216,177,95,.42); }

.panel-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}

.panel-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  color: #f8fff9;
  background: rgba(16,35,30,.86);
  box-shadow: 0 10px 24px rgba(16,35,30,.12);
  font-weight: 800;
}

.panel-chip b {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  color: #10231e;
  background: rgba(255,255,255,.9);
}

.panel-dot { width: 8px; height: 8px; border-radius: 50%; background: #aeb8b2; }
.panel-chip.online .panel-dot { background: #53e58e; box-shadow: 0 0 0 5px rgba(83,229,142,.15); }
.panel-chip.offline .panel-dot { background: #ff716b; box-shadow: 0 0 0 5px rgba(255,113,107,.13); }

.main-card { padding: 24px; }
.section-head, .list-header, .item-head, .title-row, .muted-row, .url-row, .extend-row {
  display: flex;
  align-items: center;
}

.section-head, .list-header, .item-head { justify-content: space-between; gap: 16px; }

.alert {
  margin: 16px 0;
  padding: 13px 15px;
  border-radius: 18px;
  font-weight: 750;
}
.alert.ok { color: #0f5d2f; background: var(--ok-bg); }
.alert.err { color: #8b1f1f; background: var(--danger-bg); }

.create-section {
  margin: 18px 0;
  padding: 18px;
  border: 1px solid rgba(31,143,104,.18);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(31,143,104,.08), rgba(255,255,250,.78));
}

.create-section summary {
  cursor: pointer;
  font-size: 17px;
  font-weight: 900;
  user-select: none;
}
.create-section[open] summary { margin-bottom: 16px; }

.form-row { display: grid; grid-template-columns: 1.1fr 1fr; gap: 12px; }
.form-row-compact { grid-template-columns: minmax(150px, 220px); }
.form-field { display: grid; gap: 6px; }

.out {
  margin: 16px 0;
  padding: 15px;
  border: 1px dashed rgba(31,143,104,.36);
  border-radius: 20px;
  background: rgba(233,248,239,.7);
}

.list-header {
  margin-top: 20px;
  padding: 16px 0 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.list-header span { display: block; font-size: 20px; font-weight: 950; letter-spacing: -.03em; }
.list-header small { color: var(--muted); }
.search-input { max-width: 320px; border-radius: 999px; }

.list { display: grid; gap: 14px; margin-top: 16px; }

.item {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border: 1px solid rgba(20,34,29,.1);
  border-radius: 24px;
  background: rgba(255,255,255,.78);
  box-shadow: 0 12px 30px rgba(20,34,29,.07);
  transition: transform .18s ease, box-shadow .18s ease, border .18s ease;
}
.item:hover { transform: translateY(-2px); box-shadow: 0 18px 42px rgba(20,34,29,.12); border-color: rgba(31,143,104,.24); }
.item::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: #cfd8d1; }
.item.is-online::before { background: linear-gradient(#53e58e, #1f8f68); }

.item-main { min-width: 0; }
.title-row { gap: 8px; flex-wrap: wrap; justify-content: flex-start; }
.item .title { font-size: 18px; font-weight: 950; letter-spacing: -.02em; }
.small, .muted-row, .stat-row { color: var(--muted); font-size: 12px; }
.stat-row { margin-top: 8px; }

.mini-metrics { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.mini-pill, .muted-row span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border-radius: 999px;
  color: #516059;
  background: rgba(16,35,30,.055);
  font-size: 12px;
  font-weight: 780;
}
.mini-pill.live { color: #11633f; background: rgba(83,229,142,.16); }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: #20c56c; box-shadow: 0 0 0 4px rgba(32,197,108,.14); }

.muted-row { flex-wrap: wrap; gap: 7px; margin-top: 12px; }

.url-row {
  gap: 8px;
  margin-top: 12px;
  padding: 8px;
  border: 1px solid rgba(20,34,29,.08);
  border-radius: 18px;
  background: rgba(245,248,244,.86);
}
.url-row code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: #23342e;
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.btn-copy, .btn-danger, .btn-secondary {
  width: auto;
  flex-shrink: 0;
}
.btn-copy {
  min-width: 42px;
  padding: 9px 10px;
  color: #173a31;
  background: #fff;
  border: 1px solid var(--line);
}
.btn-secondary {
  min-width: 132px;
  padding: 12px 16px;
  color: white;
  background: linear-gradient(135deg, #1f8f68, #14624e);
}
.btn-danger {
  padding: 9px 12px;
  color: #fff;
  background: linear-gradient(135deg, #df675f, #b63e38);
}
.inline-form { display: block; }
.extend-form { margin-top: 12px; }
.extend-row { display: grid; grid-template-columns: minmax(210px, 1fr) 120px auto; gap: 9px; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 950;
}
.badge-green { color: #11633f; background: #dcfce7; }
.badge-yellow { color: #7a4c12; background: #fff1bf; }
.badge-red { color: #991b1b; background: #fee2e2; }
.badge-gray { color: #5f6980; background: #eef1ed; }
.offline-txt { color: #8a958f; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px) scale(.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 920px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 14px; padding: 0; }
  .hero { min-height: auto; }
}

@media (max-width: 640px) {
  .wrap, .app-shell { width: min(100% - 18px, 1180px); }
  .app-shell { padding: 10px 0 24px; }
  .hero { padding: 24px; border-radius: 26px; flex-direction: column; }
  .stats-grid { grid-template-columns: 1fr; }
  .main-card { padding: 14px; border-radius: 24px; }
  .form-row, .form-row-compact, .extend-row { grid-template-columns: 1fr; }
  .section-head, .list-header, .item-head { align-items: stretch; flex-direction: column; }
  .search-input { max-width: 100%; }
  .url-row code { white-space: normal; word-break: break-all; }
  .btn-secondary, .btn-logout { width: 100%; }
}

/* Logo and compact subscription cards */
.login-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(300px, 100%);
  min-height: 72px;
  margin-bottom: 14px;
  padding: 14px 18px;
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(255,255,255,.95), rgba(233,248,239,.86));
  box-shadow: 0 16px 34px rgba(16,35,30,.12);
}

.login-logo img,
.hero-logo img {
  display: block;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.hero-titlebar {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}

.hero-logo {
  display: grid;
  place-items: center;
  width: 186px;
  min-width: 186px;
  height: 74px;
  padding: 12px 16px;
  border-radius: 24px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 16px 34px rgba(0,0,0,.16);
}

.app-shell {
  padding-bottom: max(42px, env(safe-area-inset-bottom));
}

.item {
  padding: 12px 12px 13px;
  border-radius: 20px;
}

.item .title {
  font-size: 16px;
}

.stat-row {
  margin-top: 6px;
}

.mini-metrics {
  gap: 6px;
  margin-top: 7px;
}

.mini-pill,
.muted-row span {
  padding: 5px 8px;
  font-size: 11px;
}

.muted-row {
  gap: 6px;
  margin-top: 8px;
}

.url-row {
  margin-top: 8px;
  padding: 6px;
  border-radius: 16px;
}

.extend-form {
  margin-top: 8px;
}

.extend-row {
  grid-template-columns: minmax(170px, 1fr) 82px 104px;
  gap: 7px;
}

.extend-row input,
.extend-row button {
  min-height: 42px;
}

.btn-secondary {
  min-width: 104px;
  padding: 10px 12px;
}

.btn-danger {
  min-width: 42px;
  min-height: 42px;
  border-radius: 14px;
}

@media (max-width: 640px) {
  .login-card {
    padding: 24px;
  }

  .login-logo {
    width: 100%;
    min-height: 58px;
    padding: 10px 12px;
    border-radius: 18px;
  }

  .hero {
    gap: 14px;
    padding: 18px;
  }

  .hero-titlebar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .hero-logo {
    width: min(240px, 100%);
    min-width: 0;
    height: 56px;
    padding: 8px 12px;
    border-radius: 18px;
  }

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

  .stat-card {
    min-height: 82px;
    padding: 12px;
    border-radius: 18px;
  }

  .stat-card strong {
    margin: 6px 0 2px;
    font-size: 24px;
  }

  .panel-strip {
    gap: 7px;
    margin: 12px 0;
  }

  .panel-chip {
    padding: 7px 10px;
    font-size: 12px;
  }

  .list {
    gap: 9px;
    margin-top: 10px;
  }

  .item {
    padding: 11px;
    border-radius: 18px;
  }

  .item-head {
    align-items: flex-start;
    flex-direction: row;
    gap: 8px;
  }

  .item-main {
    flex: 1;
  }

  .title-row {
    gap: 6px;
  }

  .item .title {
    font-size: 15px;
  }

  .mini-metrics {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 1px;
    scrollbar-width: none;
  }

  .mini-metrics::-webkit-scrollbar {
    display: none;
  }

  .mini-pill:nth-child(3),
  .mini-pill:nth-child(4) {
    display: none;
  }

  .muted-row span:first-child {
    display: none;
  }

  .stat-row {
    font-size: 11px;
  }

  .url-row code {
    white-space: nowrap;
    word-break: normal;
    text-overflow: ellipsis;
  }

  .btn-copy {
    min-width: 38px;
    padding: 8px;
  }

  .extend-row {
    grid-template-columns: minmax(0, 1fr) 56px 58px;
    gap: 6px;
  }

  .extend-row input,
  .extend-row button {
    min-height: 40px;
    padding: 9px 10px;
    font-size: 13px;
  }

  .extend-row input[name="deviceLimit"] {
    text-align: center;
  }

  .btn-secondary {
    width: auto;
    min-width: 58px;
    padding-inline: 8px;
    font-size: 0;
  }

  .btn-secondary::after {
    content: "OK";
    font-size: 13px;
  }

  .btn-danger {
    min-width: 38px;
    min-height: 38px;
    padding: 8px;
  }
}
