:root {
  --sp-ink: #151714;
  --sp-muted: #687069;
  --sp-paper: #f6f5ef;
  --sp-card: #ffffff;
  --sp-line: #dfe3dc;
  --sp-green: #58cf7e;
  --sp-green-dark: #248d4a;
  --sp-green-soft: #e3f8e9;
  --sp-danger: #c63d47;
  --sp-radius: 18px;
  --sp-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --sp-shadow: 0 12px 35px rgba(21, 23, 20, .07);
}

* { box-sizing: border-box; }
html { background: var(--sp-paper); color: var(--sp-ink); }
body {
  min-height: 100vh;
  margin: 0;
  background: var(--sp-paper) !important;
  color: var(--sp-ink);
  font-family: var(--sp-font);
}
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: 3px;
  z-index: 100;
  background: linear-gradient(90deg, var(--sp-green), #9be7b2 55%, transparent);
}
h1, h2, h3 { color: var(--sp-ink); letter-spacing: -.025em; }
h1 { font-family: Georgia, "Times New Roman", serif; }
a, button { transition: color .18s ease, background .18s ease, border-color .18s ease, transform .18s ease; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(88, 207, 126, .35) !important;
  outline-offset: 2px;
}

header {
  min-height: 76px;
  background: rgba(255,255,255,.93) !important;
  border-bottom: 1px solid var(--sp-line);
  box-shadow: none !important;
  backdrop-filter: blur(12px);
}
header h1 { margin: 0 !important; font-family: Georgia, "Times New Roman", serif; }
header nav a {
  display: inline-flex;
  min-width: 38px;
  justify-content: center;
  padding: .45rem .65rem;
  border: 1px solid var(--sp-line);
  border-radius: 999px;
  color: var(--sp-ink) !important;
  font-weight: 700;
}
header nav a:hover { background: var(--sp-green-soft); border-color: var(--sp-green); }

aside {
  width: 248px !important;
  flex: 0 0 248px;
  background: #fbfbf8 !important;
  color: var(--sp-ink);
  border-inline-end: 1px solid var(--sp-line);
  box-shadow: none !important;
  padding: 14px !important;
  display: flex;
  flex-direction: column;
  gap: 8px !important;
}
aside h2 { color: var(--sp-muted); font-family: var(--sp-font); font-size: .7rem !important; letter-spacing: .09em; text-transform: uppercase; margin: .8rem .7rem .25rem !important; }
aside nav { display: grid; gap: 3px; }
aside nav a, aside nav button { color: #343834 !important; border-radius: 9px !important; padding: .58rem .68rem !important; font-size: .875rem; font-weight: 620; }
aside nav a:hover, aside nav button:hover { color: var(--sp-ink) !important; background: #eceee9 !important; }
aside nav a.sp-active { color: var(--sp-ink) !important; background: #e6e9e3 !important; font-weight: 800; box-shadow: inset 3px 0 0 var(--sp-green); }
aside nav [x-show] { border-inline-start: 1px solid var(--sp-line); }
.sp-sidebar-brand { display: flex; align-items: center; gap: .65rem; height: 48px; padding: .35rem .55rem; color: var(--sp-ink); font-size: .98rem; font-weight: 900; }
.sp-sidebar-brand img { width: 34px; height: 34px; object-fit: contain; }
.sp-sidebar-brand small { display: block; color: var(--sp-muted); font-size: .63rem; font-weight: 650; letter-spacing: .04em; }
.sp-sidebar-section { margin: .75rem .68rem .25rem; color: #90968f; font-size: .66rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.sp-sidebar-footer { margin-top: auto; padding-top: .65rem; border-top: 1px solid var(--sp-line); }
.sp-theme-open { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: .65rem .7rem; border-radius: 10px; color: #343834; font-size: .83rem; font-weight: 750; }
.sp-theme-open:hover { background: #eceee9; }

main { min-width: 0; padding: clamp(1.25rem, 3vw, 3rem) !important; }
main > h1, main > div > h1 { font-size: clamp(2rem, 4vw, 3.35rem) !important; line-height: 1.05; }
.bg-white { background-color: var(--sp-card) !important; }
.shadow, .shadow-md, .shadow-lg, .shadow-xl { box-shadow: var(--sp-shadow) !important; }
.rounded, .rounded-md, .rounded-lg, .rounded-xl, .rounded-2xl { border-radius: var(--sp-radius) !important; }

button[class*="bg-blue"], a[class*="bg-blue"], button[class*="bg-green"], a[class*="bg-green"] {
  background: var(--sp-green) !important;
  color: var(--sp-ink) !important;
  border: 1px solid var(--sp-green) !important;
  border-radius: 999px !important;
  font-weight: 800 !important;
  box-shadow: none !important;
}
button[class*="bg-blue"]:hover, a[class*="bg-blue"]:hover,
button[class*="bg-green"]:hover, a[class*="bg-green"]:hover { background: #75db96 !important; transform: translateY(-1px); }
[class*="text-blue-"] { color: var(--sp-green-dark) !important; }
[class*="hover:text-blue"]:hover { color: var(--sp-green-dark) !important; }
[class*="bg-blue-100"], [class*="bg-green-100"] { background: var(--sp-green-soft) !important; }
[class*="text-blue-800"], [class*="text-green-800"] { color: #176f38 !important; }

input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  min-height: 46px;
  background: #fff !important;
  color: var(--sp-ink);
  border: 1px solid #cfd5ce !important;
  border-radius: 12px !important;
  padding: .7rem .85rem !important;
}
input:focus, select:focus, textarea:focus { border-color: var(--sp-green-dark) !important; box-shadow: 0 0 0 3px rgba(88,207,126,.18) !important; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--sp-green-dark); }
label { color: #3d443e; }
fieldset { border-color: var(--sp-line) !important; border-radius: var(--sp-radius) !important; background: rgba(255,255,255,.65); }

table { border-collapse: separate !important; border-spacing: 0; overflow: hidden; border: 1px solid var(--sp-line); border-radius: var(--sp-radius) !important; }
thead, thead[class*="bg-gray"] { background: #171a17 !important; color: white; }
th { font-size: .76rem; letter-spacing: .045em; text-transform: uppercase; }
th, td { border-color: var(--sp-line) !important; vertical-align: middle; }
tbody tr { background: white; }
tbody tr:hover { background: #f2fbf4; }

.fixed.inset-0[class*="bg-black"] { backdrop-filter: blur(5px); }
.fixed.inset-0 > .bg-white { border: 1px solid var(--sp-line); }
[x-cloak] { display: none !important; }

.sp-theme-backdrop { position: fixed; inset: 0; z-index: 110; display: none; background: rgba(12,14,12,.35); backdrop-filter: blur(4px); }
.sp-theme-backdrop.sp-open { display: block; }
.sp-theme-panel { position: absolute; inset: 0 0 0 auto; width: min(420px, 94vw); overflow-y: auto; padding: 28px; background: var(--sp-card); box-shadow: -20px 0 50px rgba(0,0,0,.12); }
.sp-theme-panel h2 { font-family: Georgia, "Times New Roman", serif; font-size: 2rem; }
.sp-theme-close { position: absolute; top: 22px; right: 22px; width: 38px; height: 38px; border: 1px solid var(--sp-line); border-radius: 50%; }
.sp-theme-field { display: grid; gap: 7px; margin-top: 20px; }
.sp-theme-field label { font-size: .78rem; font-weight: 800; }
.sp-theme-field input[type="color"] { width: 100%; height: 48px; padding: 4px !important; }
.sp-theme-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.sp-theme-presets button { padding: 11px 6px; border: 1px solid var(--sp-line); border-radius: 12px; font-size: .75rem; font-weight: 800; }
.sp-theme-presets button:hover { border-color: var(--sp-green-dark); background: var(--sp-green-soft); }
.sp-theme-actions { display: flex; gap: 10px; margin-top: 26px; }
.sp-theme-actions button { flex: 1; padding: 12px; border-radius: 999px; font-weight: 800; }
.sp-theme-reset { border: 1px solid var(--sp-line); }
.sp-theme-done { background: var(--sp-green); color: var(--sp-ink); }

.sp-auth-shell {
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(360px, .95fr);
  min-height: 100vh;
}
.sp-auth-story {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(2rem, 6vw, 5rem);
  background: #171a17;
  color: white;
  overflow: hidden;
  position: relative;
}
.sp-auth-story::after { content: ""; position: absolute; width: 420px; height: 420px; right: -120px; bottom: -150px; border-radius: 50%; background: var(--sp-green); opacity: .92; }
.sp-auth-brand { display: flex; align-items: center; gap: .8rem; position: relative; z-index: 1; color: white; font-size: 1.15rem; font-weight: 900; }
.sp-auth-brand img { width: 54px; height: 54px; object-fit: contain; }
.sp-auth-copy { position: relative; z-index: 1; max-width: 620px; }
.sp-auth-copy h1 { color: white; font-size: clamp(2.8rem, 6vw, 5.8rem); line-height: .94; }
.sp-auth-copy p { max-width: 530px; color: #cdd2cd; font-size: 1.05rem; }
.sp-auth-panel { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.sp-auth-card { width: 100%; max-width: 480px; }
.sp-auth-card h2 { font-family: Georgia, "Times New Roman", serif; font-size: 2.6rem; }
.sp-auth-card .oauth { display: grid; gap: .75rem; margin-top: 1rem; }
.sp-auth-card .oauth a { border: 1px solid var(--sp-line); border-radius: 999px !important; padding: .8rem 1rem; text-align: center; background: white !important; color: var(--sp-ink) !important; font-weight: 750; }
.sp-auth-card .oauth a:hover { border-color: var(--sp-green-dark); background: var(--sp-green-soft) !important; }
.sp-auth-home { color: var(--sp-green-dark); font-weight: 800; }

[dir="rtl"] aside nav [x-show] { margin-left: 0 !important; margin-right: 1.25rem; }
[dir="rtl"] th, [dir="rtl"] td, [dir="rtl"] .text-left { text-align: right !important; }
[dir="rtl"] .text-right { text-align: left !important; }

@media (max-width: 900px) {
  header { flex-wrap: wrap; gap: .75rem; justify-content: space-between !important; padding: 1rem !important; }
  body > .flex, header + .flex { display: block !important; }
  aside { width: 100% !important; min-height: auto; padding: 1rem !important; }
  aside nav { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .35rem; }
  aside nav > * { min-width: max-content; }
  main { padding: 1.25rem !important; }
  table { display: block; width: 100%; overflow-x: auto; white-space: nowrap; }
  .sp-auth-shell { grid-template-columns: 1fr; }
  .sp-auth-story { min-height: 310px; padding: 2rem; }
  .sp-auth-copy h1 { font-size: 3rem; }
  .sp-auth-panel { padding: 2rem 1.25rem; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
