@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

:root {
  --bg: #f1f8f7;
  --panel: #ffffff;
  --panel-soft: #f3f9f8;
  --text: #18333b;
  --text-soft: #587078;
  --text-muted: #82939a;
  --line: #d7e7e4;
  --blue: #147d8a;
  --blue-dark: #0e5d68;
  --blue-soft: #e1f2f0;
  --green: #35a268;
  --green-soft: #e4f6eb;
  --orange: #e89452;
  --orange-soft: #fff0e1;
  --red: #c65f67;
  --shadow: 0 22px 60px rgba(26, 76, 78, 0.12);
  --shadow-soft: 0 8px 24px rgba(26, 76, 78, 0.08);
  --font: "Manrope", "Segoe UI", Arial, sans-serif;
}

body.dark {
  --bg: #10282d;
  --panel: #17383d;
  --panel-soft: #1d4448;
  --text: #effbf8;
  --text-soft: #b1cfca;
  --text-muted: #86aaa7;
  --line: #2d5a5d;
  --blue: #6dd4d0;
  --blue-dark: #a0ece2;
  --blue-soft: #214f52;
  --green: #76d99e;
  --green-soft: #1d5140;
  --orange: #ffc17d;
  --orange-soft: #5b3b25;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at 82% 0%, rgba(95, 196, 181, 0.16), transparent 28%),
    radial-gradient(circle at 12% 92%, rgba(244, 173, 112, 0.12), transparent 24%),
    var(--bg);
}

.app-shell {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: 264px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 36px 24px;
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue-soft);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.brand-icon .icon {
  width: 30px;
  height: 30px;
}

.brand-logo {
  width: 46px;
  height: 46px;
  object-fit: cover;
  display: block;
}

.brand-text {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
}

.brand-text span {
  color: var(--blue);
}

.nav {
  margin-top: 58px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  border-radius: 14px;
  color: var(--text-soft);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  transition: 0.2s ease;
}

.nav-item.active,
.nav-item:hover {
  color: var(--blue);
  background: var(--blue-soft);
}

.nav-icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
}

.nav-icon-wrap {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.nav-icon-img {
  width: 20px;
  height: 20px;
  display: block;
  object-fit: cover;
}

.menu-panel {
  margin-top: 24px;
  padding: 20px 16px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.menu-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.menu-panel-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-panel-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  border: 1px solid transparent;
  transition: 0.2s ease;
}

.menu-panel-link.active,
.menu-panel-link:hover {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: var(--line);
}

.menu-panel-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.menu-panel-icon .icon {
  width: 18px;
  height: 18px;
}

.sidebar-card {
  margin-top: 58px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
}

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

.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--green));
}

.name {
  font-weight: 800;
  font-size: 14px;
}

.status-dot-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

.status-text {
  color: var(--text-muted);
  font-size: 12px;
}

.main {
  flex: 1;
  padding: 30px 36px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.breadcrumb {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 10px 0 0;
  font-size: clamp(34px, 3vw, 44px);
  font-weight: 800;
  letter-spacing: -1.5px;
}

.icon-button {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-button .icon {
  width: 24px;
  height: 24px;
}

.stats-grid {
  margin: 30px 0 20px;
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 20px;
}

.stat-card {
  background: var(--panel);
  padding: 24px;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.stat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.stat-icon.orange {
  background: var(--orange-soft);
  color: var(--orange);
}

.stat-icon.green {
  background: var(--green-soft);
  color: var(--green);
}

.tiny {
  width: 18px;
  height: 18px;
}

.stat-value {
  font-size: clamp(34px, 3vw, 42px);
  font-weight: 900;
  margin-top: 25px;
  letter-spacing: -1px;
}

.stat-foot {
  color: var(--text-muted);
  font-size: 12px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(480px, 1.6fr) minmax(330px, 1fr);
  gap: 20px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px;
  box-shadow: var(--shadow-soft);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-head h2 {
  margin: 8px 0 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.section-tag {
  font-weight: 800;
  color: var(--blue);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.pulse-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green);
  border: 4px solid var(--green-soft);
  box-shadow: 0 0 0 6px var(--green-soft);
}

#shortlinkForm {
  margin-top: 28px;
}

.field-group {
  margin-bottom: 20px;
}

.field-group label {
  display: block;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.input-wrap,
.select-wrap,
.textarea-wrap {
  min-height: 56px;
  border-radius: 16px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 16px;
}

.input-wrap {
  gap: 10px;
}

.textarea-wrap {
  min-height: 110px;
  align-items: flex-start;
  padding: 14px 16px;
}

.textarea-wrap textarea {
  width: 100%;
  min-height: 100px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}

.textarea-wrap textarea::placeholder {
  color: var(--text-muted);
}

.input-icon {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
}

.input-wrap input {
  flex: 1;
  min-width: 0;
  height: 56px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
}

.input-wrap input::placeholder {
  color: var(--text-muted);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 16px;
}

.select-wrap {
  padding: 0;
}

.select-wrap select {
  width: 100%;
  height: 56px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  padding: 0 16px;
  font-family: inherit;
  font-size: 15px;
}

.actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 20px;
}

.primary-button {
  min-height: 54px;
  padding: 0 28px;
  border: none;
  border-radius: 16px;
  color: #fff;
  background: var(--blue);
  font-family: inherit;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary-button:hover {
  background: var(--blue-dark);
}

.secondary-button {
  min-height: 54px;
  padding: 0 20px;
  border-radius: 16px;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel-soft);
  font-family: var(--font);
  font-weight: 800;
  cursor: pointer;
}

.button-icon {
  width: 22px;
  height: 22px;
}

.result-panel {
  margin-top: 22px;
  padding: 20px 0 4px;
  border-top: 1px solid var(--line);
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.badge {
  background: var(--green-soft);
  color: var(--green);
  border-radius: 99px;
  padding: 8px 10px;
  font-weight: 900;
  font-size: 10px;
  text-transform: uppercase;
}

.result-output {
  margin-top: 14px;
  background: var(--panel-soft);
  border-radius: 18px;
  border: 1px dashed var(--line);
  padding: 16px;
}

.result-output a {
  color: var(--blue);
  font-size: 20px;
  font-weight: 900;
  text-decoration: none;
  word-break: break-all;
}

.result-actions {
  margin-top: 14px;
  display: flex;
  gap: 12px;
}

.small-button {
  height: 42px;
  padding: 0 20px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--blue-soft);
  color: var(--blue);
  font-family: var(--font);
  font-weight: 900;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.small-button.ghost {
  background: transparent;
  color: var(--text);
}

.history-panel {
  min-height: 420px;
}

.history-list {
  margin-top: 26px;
}

.history-item {
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}

.history-item:last-child {
  border-bottom: none;
}

.history-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.short-link {
  color: var(--blue);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.history-url {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
  margin-top: 8px;
}

.history-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 14px;
}

.history-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.history-meta svg {
  width: 14px;
  height: 14px;
}

.history-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}

.history-action {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel-soft);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.history-action.edit {
  color: var(--blue);
  background: var(--blue-soft);
}

.history-action.delete {
  color: var(--red);
}

.history-date {
  padding: 3px 8px;
  background: var(--blue-soft);
  border-radius: 99px;
  font-weight: 800;
}

.small-icon {
  width: 40px;
  height: 40px;
}

.hidden {
  display: none;
}

.empty {
  color: var(--text-muted);
  font-weight: 800;
  font-size: 14px;
  padding: 22px 0;
}

.toast {
  position: fixed;
  right: 30px;
  bottom: 30px;
  min-width: 210px;
  background: var(--text);
  color: var(--panel);
  padding: 12px 16px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 12px;
  opacity: 0;
  transform: translateY(12px);
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Classic analytics/statistics view styling */
.analytics-layout {
  grid-template-columns: minmax(430px, 1.8fr) minmax(360px, 1fr);
}

.analytics-main {
  min-height: 100vh;
}

.analytics-panel {
  min-height: 420px;
}

.analytics-card {
  margin-top: 24px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
}

.analytics-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mini-link {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
}

.country-list,
.browser-list {
  margin-top: 14px;
}

.country-row,
.browser-row {
  display: grid;
  grid-template-columns: 130px 1fr 54px;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.country-row:last-child,
.browser-row:last-child {
  border-bottom: none;
}

.country-name,
.browser-label {
  color: var(--text-soft);
  font-weight: 800;
  font-size: 12px;
}

.country-count,
.browser-num {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.country-bar-wrap,
.browser-track {
  display: block;
  height: 8px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
}

.country-bar,
.browser-fill {
  display: block;
  height: 100%;
  background: var(--blue);
  border-radius: inherit;
}

.browser-fill.chrome { background: var(--green); }
.browser-fill.safari { background: var(--orange); }
.browser-fill.firefox { background: var(--blue-dark); }

.table-wrap {
  margin-top: 20px;
  overflow-x: auto;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.stats-table th {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-align: left;
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
}

.stats-table td {
  padding: 14px 10px;
  color: var(--text-soft);
  border-bottom: 1px solid var(--line);
}

.stats-table tr:last-child td {
  border-bottom: none;
}

@media (max-width: 950px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .nav {
    margin-top: 30px;
  }

  .workspace-grid,
  .stats-grid,
  .analytics-layout {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 20px;
  }
}

@media (max-width: 600px) {
  .sidebar {
    padding: 24px 16px;
  }

  .brand-text {
    font-size: 24px;
  }

  .main {
    width: 100%;
    min-width: 0;
    padding: 16px;
  }

  .topbar {
    gap: 16px;
    align-items: flex-start;
  }

  .topbar h1 {
    font-size: clamp(30px, 9vw, 38px);
  }

  .stats-grid,
  .workspace-grid,
  .analytics-layout {
    min-width: 0;
  }

  .panel,
  .stat-card {
    min-width: 0;
    padding: 20px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-wrap: wrap;
  }

  .primary-button,
  .secondary-button {
    flex: 1 1 100%;
    justify-content: center;
  }

  .result-output a {
    font-size: 16px;
  }

  .history-url {
    max-width: 100%;
  }
}
