/* ============================================================
   Claymorphism Design System — Internal Access Tool
   ============================================================ */

:root {
  /* Surface */
  --bg: #e0e5ec;
  --surface: #e0e5ec;

  /* Text */
  --text: #4a5568;
  --text-light: #718096;
  --text-white: #ffffff;

  /* Macaron Palette */
  --pink-light: #ffc8dd;
  --pink: #ffafcc;
  --pink-deep: #ff8fab;

  --blue-light: #cae9ff;
  --blue: #a2d2ff;
  --blue-deep: #7eb8e0;

  --purple-light: #e4c1f9;
  --purple: #cdb4db;
  --purple-deep: #b377dc;

  --green-light: #d8f3dc;
  --green: #b7e4c7;
  --green-deep: #74c69d;

  --yellow-light: #fff4bd;
  --yellow: #ffe6a7;
  --yellow-deep: #ffcc77;

  --orange-light: #ffecd2;
  --orange: #fcb69f;

  /* Status */
  --good: #74c69d;
  --good-text: #2f6d44;
  --warn: #ffe6a7;
  --warn-text: #9f5a14;
  --bad: #ffafcc;
  --bad-text: #a3333d;

  /* Shadows — The Soul of Claymorphism */
  --shadow-convex:
    9px 9px 16px rgba(163,177,198,0.6),
    -9px -9px 16px rgba(255,255,255,0.5),
    inset 5px 5px 10px rgba(163,177,198,0.15),
    inset -5px -5px 10px rgba(255,255,255,0.45);

  --shadow-convex-sm:
    5px 5px 10px rgba(163,177,198,0.5),
    -5px -5px 10px rgba(255,255,255,0.5),
    inset 3px 3px 6px rgba(163,177,198,0.12),
    inset -3px -3px 6px rgba(255,255,255,0.4);

  --shadow-hover:
    14px 14px 24px rgba(163,177,198,0.6),
    -14px -14px 24px rgba(255,255,255,0.5),
    inset 5px 5px 10px rgba(163,177,198,0.15),
    inset -5px -5px 10px rgba(255,255,255,0.45);

  --shadow-concave:
    inset 6px 6px 10px rgba(163,177,198,0.5),
    inset -6px -6px 10px rgba(255,255,255,0.7);

  --shadow-active:
    inset 4px 4px 8px rgba(163,177,198,0.5),
    inset -4px -4px 8px rgba(255,255,255,0.7);

  /* Colored Shadows */
  --shadow-pink:
    6px 6px 14px rgba(255,143,171,0.35),
    -6px -6px 14px rgba(255,255,255,0.5),
    inset 3px 3px 6px rgba(255,255,255,0.25),
    inset -3px -3px 6px rgba(255,143,171,0.2);

  --shadow-blue:
    6px 6px 14px rgba(126,184,224,0.35),
    -6px -6px 14px rgba(255,255,255,0.5),
    inset 3px 3px 6px rgba(255,255,255,0.25),
    inset -3px -3px 6px rgba(126,184,224,0.2);

  --shadow-green:
    6px 6px 14px rgba(116,198,157,0.35),
    -6px -6px 14px rgba(255,255,255,0.5),
    inset 3px 3px 6px rgba(255,255,255,0.25),
    inset -3px -3px 6px rgba(116,198,157,0.2);

  --shadow-purple:
    6px 6px 14px rgba(179,119,220,0.3),
    -6px -6px 14px rgba(255,255,255,0.5),
    inset 3px 3px 6px rgba(255,255,255,0.25),
    inset -3px -3px 6px rgba(179,119,220,0.2);

  /* Animation */
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);

  /* Font */
  --font-code: 'Cascadia Code', 'Consolas', monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: 'Nunito', 'Segoe UI', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--blue-deep);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ============================================================
   Layout
   ============================================================ */

.page-shell {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px 64px;
}

/* ============================================================
   Hero
   ============================================================ */

.hero {
  display: grid;
  gap: 18px;
  margin-bottom: 32px;
}

.hero h1,
.hero h2,
.section-title,
.panel-title {
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 2.8rem);
  line-height: 1.1;
}

.hero p {
  max-width: 68ch;
  margin: 0;
  color: var(--text-light);
  font-size: 1rem;
  line-height: 1.65;
}

.hero-strip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-radius: 50px;
  background: var(--surface);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-light);
  box-shadow: var(--shadow-convex-sm);
}

.hero-strip strong {
  color: #8a4860;
  background: var(--pink-light);
  padding: 2px 10px;
  border-radius: 50px;
}

/* ============================================================
   Cards / Panels — Clay Convex
   ============================================================ */

.panel,
.card,
.metric,
.chart,
.table-wrap {
  background: var(--surface);
  border: 2px solid rgba(255,255,255,0.25);
  box-shadow: var(--shadow-convex);
}

.panel {
  border-radius: 32px;
  padding: 28px;
}

.card {
  border-radius: 28px;
  padding: 22px;
}

.metric {
  border-radius: 28px;
  padding: 22px;
  transition: transform 0.3s var(--spring);
}

.metric:hover {
  transform: translateY(-4px);
}

.metric-label {
  font-size: 0.88rem;
  color: var(--text-light);
  font-weight: 600;
}

.metric-value {
  margin-top: 10px;
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--text);
}

.metric-note {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-light);
}

/* Colored metric icons */
.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  box-shadow: var(--shadow-convex-sm);
}

.metric-icon.pink { background: var(--pink-light); color: #8a4860; }
.metric-icon.blue { background: var(--blue-light); color: #43658b; }
.metric-icon.green { background: var(--green-light); color: #3d6b4f; }
.metric-icon.purple { background: var(--purple-light); color: #6b4c7a; }

/* ============================================================
   Grid
   ============================================================ */

.grid {
  display: grid;
  gap: 20px;
}

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

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

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 28px;
}

/* ============================================================
   Section
   ============================================================ */

.section {
  margin-top: 28px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 18px;
}

.section-header h2 {
  margin: 0;
}

.section-header p {
  margin: 0;
  color: var(--text-light);
  font-size: 0.95rem;
}

.section-title {
  font-size: 1.6rem;
}

.section-subtitle {
  margin: 0;
  color: var(--text-light);
}

/* ============================================================
   Status Badges — Clay Style
   ============================================================ */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
}

.status-ok {
  background: var(--green-light);
  color: var(--good-text);
  box-shadow:
    3px 3px 6px rgba(116,198,157,0.2),
    -3px -3px 6px rgba(255,255,255,0.5),
    inset 1px 1px 3px rgba(255,255,255,0.3),
    inset -1px -1px 3px rgba(116,198,157,0.15);
}

.status-warn {
  background: var(--yellow-light);
  color: var(--warn-text);
  box-shadow:
    3px 3px 6px rgba(255,204,119,0.2),
    -3px -3px 6px rgba(255,255,255,0.5),
    inset 1px 1px 3px rgba(255,255,255,0.3),
    inset -1px -1px 3px rgba(255,204,119,0.15);
}

.status-bad {
  background: var(--pink-light);
  color: var(--bad-text);
  box-shadow:
    3px 3px 6px rgba(255,143,171,0.2),
    -3px -3px 6px rgba(255,255,255,0.5),
    inset 1px 1px 3px rgba(255,255,255,0.3),
    inset -1px -1px 3px rgba(255,143,171,0.15);
}

/* ============================================================
   Soft Badge (for non-status info badges)
   ============================================================ */

.soft-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 50px;
  background: var(--blue-light);
  color: #43658b;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow:
    3px 3px 6px rgba(126,184,224,0.2),
    -3px -3px 6px rgba(255,255,255,0.5),
    inset 1px 1px 3px rgba(255,255,255,0.3),
    inset -1px -1px 3px rgba(126,184,224,0.15);
}

/* ============================================================
   Flash Messages — Clay Style
   ============================================================ */

.flash {
  padding: 16px 22px;
  border-radius: 24px;
  margin: 18px 0;
  font-weight: 600;
  border: none;
}

.flash.error {
  background: var(--pink-light);
  color: var(--bad-text);
  box-shadow:
    inset 3px 3px 6px rgba(255,143,171,0.2),
    inset -3px -3px 6px rgba(255,255,255,0.4);
}

.flash.success {
  background: var(--green-light);
  color: var(--good-text);
  box-shadow:
    inset 3px 3px 6px rgba(116,198,157,0.2),
    inset -3px -3px 6px rgba(255,255,255,0.4);
}

/* ============================================================
   Form Layout
   ============================================================ */

.form-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(2, 1fr);
}

.form-grid .full {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 10px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  margin-left: 8px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

/* ============================================================
   Inputs — Concave / Carved Look
   ============================================================ */

.input,
.textarea {
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-concave);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  outline: none;
  transition: box-shadow 0.25s var(--ease);
}

.input:focus,
.textarea:focus {
  box-shadow:
    inset 8px 8px 14px rgba(163,177,198,0.6),
    inset -8px -8px 14px rgba(255,255,255,0.85),
    0 0 0 4px rgba(162,210,255,0.25);
}

.input::placeholder,
.textarea::placeholder {
  color: #a0aec0;
  font-weight: 400;
}

.textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.6;
}

/* ============================================================
   Buttons — Clay Style
   ============================================================ */

.button,
.ghost-button,
.copy-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 50px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.25s var(--spring);
}

.button {
  padding: 12px 28px;
  background: var(--pink);
  color: #8a4860;
  box-shadow: var(--shadow-pink);
}

.button:hover {
  transform: translateY(-3px);
  box-shadow:
    8px 8px 18px rgba(255,143,171,0.45),
    -8px -8px 18px rgba(255,255,255,0.6),
    inset 3px 3px 6px rgba(255,255,255,0.25),
    inset -3px -3px 6px rgba(255,143,171,0.2);
  text-decoration: none;
}

.button:active {
  transform: translateY(0) scale(0.96);
  box-shadow: var(--shadow-active);
}

.ghost-button {
  padding: 10px 22px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-convex-sm);
}

.ghost-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-convex);
  text-decoration: none;
}

.ghost-button:active {
  transform: translateY(0) scale(0.97);
  box-shadow: var(--shadow-active);
}

.copy-button {
  padding: 8px 16px;
  background: var(--blue-light);
  color: #43658b;
  font-size: 0.85rem;
  box-shadow:
    3px 3px 6px rgba(126,184,224,0.2),
    -3px -3px 6px rgba(255,255,255,0.5),
    inset 1px 1px 3px rgba(255,255,255,0.3),
    inset -1px -1px 3px rgba(126,184,224,0.15);
  white-space: nowrap;
}

.copy-button:hover {
  transform: translateY(-2px);
}

.copy-button:active {
  transform: scale(0.95);
  box-shadow: var(--shadow-active);
}

/* ============================================================
   Helper
   ============================================================ */

.helper {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--text-light);
}

.field .helper {
  margin: 0;
  margin-left: 8px;
}

/* ============================================================
   Split Layout
   ============================================================ */

.split {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
}

/* ============================================================
   Data Card
   ============================================================ */

.data-card {
  display: grid;
  gap: 12px;
}

.data-card h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
}

.kv-list {
  display: grid;
  gap: 10px;
}

.kv-item {
  display: grid;
  gap: 6px;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(255,255,255,0.25);
  box-shadow:
    inset 2px 2px 5px rgba(163,177,198,0.18),
    inset -2px -2px 5px rgba(255,255,255,0.5);
}

.kv-key {
  font-size: 0.8rem;
  color: var(--text-light);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}

.kv-value {
  font-family: var(--font-code);
  font-size: 0.93rem;
  word-break: break-word;
  line-height: 1.6;
}

/* ============================================================
   Navigation — Clay Capsule Bar
   ============================================================ */

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--surface);
  border-radius: 50px;
  box-shadow: var(--shadow-convex);
  margin-bottom: 36px;
}

.brand {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* ============================================================
   Table — Clay Card Wrap
   ============================================================ */

.table-wrap {
  border-radius: 32px;
  overflow: hidden;
  margin-top: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 18px;
  text-align: left;
  vertical-align: middle;
}

thead th {
  background: rgba(255,255,255,0.3);
  font-size: 0.82rem;
  color: var(--text-light);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 700;
  border-bottom: 2px solid rgba(163,177,198,0.2);
}

tbody tr {
  transition: background 0.2s var(--ease);
}

tbody tr:hover {
  background: rgba(255,255,255,0.25);
}

tbody td {
  border-top: 1px solid rgba(163,177,198,0.12);
  font-size: 0.95rem;
}

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

/* ============================================================
   Mono / Code
   ============================================================ */

.mono {
  font-family: var(--font-code);
}

.code-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: 50px;
  background: var(--surface);
  box-shadow: var(--shadow-convex-sm);
  font-family: var(--font-code);
  font-size: 0.88rem;
  border: 2px solid rgba(255,255,255,0.25);
}

/* ============================================================
   Stats Bars — Concave Track
   ============================================================ */

.stats-bars {
  display: grid;
  gap: 14px;
}

.stats-row {
  display: grid;
  gap: 12px;
  grid-template-columns: 80px minmax(0, 1fr) 40px;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
}

.stats-track {
  height: 14px;
  border-radius: 50px;
  background: var(--surface);
  box-shadow: var(--shadow-concave);
  overflow: hidden;
  position: relative;
}

.stats-fill {
  height: 100%;
  border-radius: 50px;
  background: linear-gradient(90deg, var(--blue), var(--pink));
  box-shadow:
    inset -2px -2px 4px rgba(255,255,255,0.3),
    inset 2px 2px 4px rgba(126,184,224,0.2);
  transition: width 0.5s var(--spring);
}

/* ============================================================
   JSON Block — Dark Concave
   ============================================================ */

.json-block {
  margin: 0;
  padding: 22px;
  border-radius: 24px;
  background: #2d3748;
  color: #e2e8f0;
  font-family: var(--font-code);
  font-size: 0.85rem;
  line-height: 1.55;
  overflow: auto;
  box-shadow:
    inset 6px 6px 12px rgba(0,0,0,0.25),
    inset -6px -6px 12px rgba(55,65,81,0.3);
  border: 2px solid rgba(255,255,255,0.06);
}

/* ============================================================
   Empty State
   ============================================================ */

.empty-state {
  padding: 24px;
  border-radius: 24px;
  background: var(--surface);
  color: var(--text-light);
  box-shadow: var(--shadow-concave);
  font-weight: 600;
}

/* ============================================================
   Custom Dropdown (replaces native select)
   ============================================================ */

.clay-dropdown {
  position: relative;
  width: 100%;
}

.clay-dropdown-trigger {
  width: 100%;
  padding: 14px 44px 14px 20px;
  border: none;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-concave);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  outline: none;
  position: relative;
  transition: box-shadow 0.25s var(--ease);
}

.clay-dropdown-trigger::after {
  content: '';
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--purple-light);
  box-shadow: var(--shadow-convex-sm);
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='7' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b4c7a' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  transition: transform 0.3s var(--spring);
}

.clay-dropdown.open .clay-dropdown-trigger::after {
  transform: translateY(-50%) rotate(180deg);
}

.clay-dropdown.open .clay-dropdown-trigger {
  box-shadow:
    inset 8px 8px 14px rgba(163,177,198,0.6),
    inset -8px -8px 14px rgba(255,255,255,0.85),
    0 0 0 4px rgba(162,210,255,0.25);
}

.clay-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  z-index: 100;
  padding: 8px;
  background: var(--surface);
  border-radius: 24px;
  border: 2px solid rgba(255,255,255,0.25);
  box-shadow:
    12px 12px 24px rgba(163,177,198,0.5),
    -12px -12px 24px rgba(255,255,255,0.6);
  animation: dropdown-in 0.25s var(--spring);
}

@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.clay-dropdown.open .clay-dropdown-menu {
  display: block;
}

.clay-dropdown-item {
  display: block;
  width: 100%;
  padding: 12px 18px;
  border: none;
  border-radius: 18px;
  background: transparent;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s var(--ease);
}

.clay-dropdown-item:hover {
  background: var(--blue-light);
  color: #43658b;
  box-shadow:
    inset 2px 2px 4px rgba(126,184,224,0.15),
    inset -2px -2px 4px rgba(255,255,255,0.4);
}

.clay-dropdown-item.active {
  background: var(--blue);
  color: #fff;
  box-shadow: var(--shadow-blue);
}

/* ============================================================
   Floating Blob Decorations
   ============================================================ */

.blob {
  position: absolute;
  border-radius: 45% 55% 40% 60% / 50% 60% 40% 50%;
  box-shadow: var(--shadow-convex);
  animation: blob-float 6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes blob-float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); border-radius: 45% 55% 40% 60% / 50% 60% 40% 50%; }
  33% { transform: translate(0, -15px) rotate(4deg); border-radius: 50% 50% 50% 50%; }
  66% { transform: translate(0, 8px) rotate(-4deg); border-radius: 60% 40% 60% 40% / 40% 60% 40% 60%; }
}

/* ============================================================
   Checkbox — Clay Style
   ============================================================ */

input[type="checkbox"] {
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-concave);
  cursor: pointer;
  position: relative;
  transition: all 0.2s var(--ease);
  flex-shrink: 0;
}

input[type="checkbox"]:checked {
  background: var(--blue);
  box-shadow:
    inset 3px 3px 6px rgba(126,184,224,0.4),
    inset -3px -3px 6px rgba(255,255,255,0.3);
}

input[type="checkbox"]:checked::after {
  content: '\2713';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

/* ============================================================
   Icon sizing helper
   ============================================================ */

.icon-sm { width: 18px; height: 18px; }
.icon-md { width: 22px; height: 22px; }

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 960px) {
  .grid.two,
  .grid.three,
  .grid.four,
  .split,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .page-shell {
    padding: 24px 14px 40px;
  }

  .hero h1 {
    max-width: none;
  }

  .stats-row {
    grid-template-columns: 74px minmax(0, 1fr) 32px;
  }

  th,
  td {
    padding: 12px;
  }

  .top-nav {
    border-radius: 24px;
    padding: 10px 16px;
  }
}

@media (max-width: 640px) {
  .grid.four {
    grid-template-columns: repeat(2, 1fr);
  }

  h1 {
    font-size: 2rem;
  }
}
