:root {
  --bg: #0f172a;
  --bg-2: #111c34;
  --panel: #ffffff;
  --panel-2: #f6f8fb;
  --border: #e4e9f2;
  --text: #1a2436;
  --muted: #64748b;
  --primary: #0b6b3a;
  --primary-2: #0e8a4b;
  --primary-soft: #e7f5ec;
  --accent: #1e63d0;
  --danger: #c0392b;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--panel-2);
}

a { text-decoration: none; color: inherit; }

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: #cdd6e6;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 6px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand__logo {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--primary-2), var(--primary));
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 20px;
  color: #fff;
}

.brand__text { display: flex; flex-direction: column; }
.brand__name { font-weight: 700; color: #fff; font-size: 16px; }
.brand__sub { font-size: 12px; color: #8ea0bd; }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 18px; flex: 1; }

.nav__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7d9c;
  margin: 16px 10px 6px;
}

.nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  color: #cdd6e6;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}

.nav__item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav__item.is-active { background: var(--primary); color: #fff; }
.nav__item.is-disabled { opacity: 0.45; cursor: not-allowed; }
.nav__icon { width: 20px; text-align: center; }

.sidebar__footer {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #8ea0bd;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot--green { background: #34d17a; box-shadow: 0 0 0 3px rgba(52,209,122,0.2); }

/* Main */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar__title h1 { margin: 0; font-size: 20px; }
.topbar__title p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.topbar__right { margin-left: auto; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
}

.icon-btn {
  display: none;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 40px; height: 40px;
  font-size: 18px; cursor: pointer;
}

.content { padding: 28px; flex: 1; max-width: 1100px; width: 100%; }

/* Hero */
.hero {
  background: linear-gradient(120deg, #0b6b3a 0%, #0e8a4b 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: var(--shadow);
}
.hero__text h2 { margin: 0 0 8px; font-size: 24px; }
.hero__text p { margin: 0; max-width: 620px; color: #dbf3e4; line-height: 1.5; }
.hero__badge {
  background: rgba(255,255,255,0.15);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
}

.section-title { margin: 30px 0 14px; font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  position: relative;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #cfe6d8; }
.card__icon {
  width: 46px; height: 46px; border-radius: 12px;
  background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-size: 22px; margin-bottom: 4px;
}
.card h4 { margin: 0; font-size: 16px; }
.card p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.card__cta { margin-top: auto; color: var(--primary); font-weight: 600; font-size: 14px; padding-top: 8px; }
.card--soon { opacity: 0.75; }
.card--soon:hover { transform: none; box-shadow: none; border-color: var(--border); }
.card__badge {
  margin-top: auto; padding-top: 8px;
  font-size: 12px; color: var(--muted); font-weight: 600;
}

/* Footer */
.footer {
  display: flex;
  justify-content: space-between;
  padding: 18px 28px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

/* ---------- Tool page ---------- */
.tool-wrap { max-width: 860px; }

.breadcrumbs { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.breadcrumbs a { color: var(--primary); }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

.input-row { display: flex; gap: 10px; }

input[type="text"], input[type="url"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text);
  background: var(--panel-2);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="text"]:focus, input[type="url"]:focus {
  outline: none;
  border-color: var(--primary-2);
  box-shadow: 0 0 0 3px rgba(14,138,75,0.15);
  background: #fff;
}
.prefix-box {
  display: flex;
  align-items: center;
  gap: 4px;
}
.prefix {
  padding: 12px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 10px 0 0 10px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}
.prefix + input { border-radius: 0 10px 10px 0; }

.btn {
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-2); }
.btn--ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
.btn--ghost:hover { background: #eef2f7; }
.btn--sm { padding: 7px 12px; font-size: 13px; }
.btn--danger { background: #fdecea; color: var(--danger); }
.btn--danger:hover { background: #fbdad6; }

.alert {
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}
.alert.is-visible { display: block; }
.alert--error { background: #fdecea; color: var(--danger); }
.alert--success { background: var(--primary-soft); color: var(--primary); }

.result {
  margin-top: 18px;
  padding: 16px;
  border: 1px dashed #b9dcc8;
  border-radius: 12px;
  background: var(--primary-soft);
  display: none;
}
.result.is-visible { display: block; }
.result__label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.result__row { display: flex; gap: 10px; align-items: center; }
.result__link {
  flex: 1;
  font-weight: 700;
  color: var(--primary);
  word-break: break-all;
  font-size: 15px;
}

/* Table of saved links */
.saved { margin-top: 30px; }
.saved__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.saved__head h3 { margin: 0; font-size: 16px; }

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.table th, .table td {
  text-align: left;
  padding: 12px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table th { background: var(--panel-2); color: var(--muted); font-weight: 600; }
.table tr:last-child td { border-bottom: none; }
.table .short a { color: var(--primary); font-weight: 600; }
.table .long { color: var(--muted); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .clicks { text-align: center; font-weight: 600; }
.table .actions { white-space: nowrap; display: flex; gap: 6px; }

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Redirect page */
.redirect {
  min-height: 100vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
}
.redirect__card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow);
  max-width: 480px;
}
.spinner {
  width: 42px; height: 42px;
  border: 4px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 20;
    left: 0; top: 0;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.2s;
  }
  .sidebar.is-open { transform: translateX(0); }
  .icon-btn { display: grid; place-items: center; }
  .hero { flex-direction: column; align-items: flex-start; }
}
