/* ==========================================================================
   Smartisan UI — Framework-Agnostic Core Stylesheet (WordPress / HTML / Vue / React)
   - Light Mode: 2018 Smartisan Web & Smartisan OS (woven cotton linen, die-cut
     paper cards, brushed silver headers, porcelain blue-dot switch, Smartisan Blue)
   - Dark Mode:  Smartisan Notes v4.3 (锤子便签) warm-neutral carbon charcoal
     (7px vertical-ribbed matte paper #111112 -> cards #1C1A1D -> modals #232124,
      soft alabaster text #D8D6DA, Smartisan Dark Blue #6084D8 / #6F91E0,
      disabled navy #212F4C, warm brass ink #BEA17A)
   ========================================================================== */

:root,
:root[data-theme="light"],
:root[theme-mode="light"] {
  color-scheme: light;

  /* Overridable Texture URLs (override in WordPress via wp_add_inline_style if relocated) */
  --sm-linen-texture: url('../images/smartisan-linen.png');
  --sm-dark-ribbed-texture: url('../images/smartisan-dark-ribbed.png');
  --sm-grille-texture: url('../images/smartisan-pattern.jpg');

  /* Brand & Accent */
  --sm-brand: #5F7ED7;
  --sm-brand-hover: #6B95EA;
  --sm-brand-active: #4C69B8;
  --sm-brand-soft: rgba(95, 126, 215, 0.10);
  --sm-brand-ring: rgba(95, 126, 215, 0.28);
  --sm-blue: #5F7ED7;
  --sm-os-blue: #7496EE;
  --sm-success: #469156;
  --sm-warning: #C98A28;
  --sm-danger: #CC3E39;
  --sm-brass: #9E7E52;
  --sm-brass-bg: #F6F1E8;

  /* Surface Elevation Ladder */
  --sm-bg-canvas: #ECECEC;
  --sm-bg-chrome: #F8F8F8;
  --sm-bg-topbar: linear-gradient(180deg, #FCFCFC 0%, #F3F3F3 100%);
  --sm-bg-surface: #FAFAFA;
  --sm-bg-elevated: #FFFFFF;
  --sm-bg-modal: #FFFFFF;
  --sm-bg-recessed: #E5E5E5;
  --sm-bg-input: #FFFFFF;
  --sm-bg-sidebar: linear-gradient(180deg, #161719 0%, #0A0B0C 100%);

  /* Borders & Hairlines */
  --sm-chrome-border: #D6D6D6;
  --sm-border: #D9D9D9;
  --sm-border-hover: #BDBFC6;
  --sm-border-subtle: #E8E8EB;
  --sm-card-border: rgba(0, 0, 0, 0.085);
  --sm-input-border: #CCCCCC;
  --sm-sidebar-border: #23252A;

  /* Typography */
  --sm-text: #212121;
  --sm-text-heading: #1C1E22;
  --sm-text-secondary: #626262;
  --sm-text-muted: #8C8C8C;
  --sm-sidebar-text: #F2F3F5;
  --sm-sidebar-text-muted: #9C9FA6;

  /* Surfaces, Headers & Shadows */
  --sm-card-header-bg: linear-gradient(180deg, #FAFAFA 0%, #F2F2F2 100%);
  --sm-table-header-bg: #F6F7F8;
  --sm-table-row-hover: #F7F9FC;
  --sm-modal-header-bg: linear-gradient(180deg, #FBFBFB 0%, #EAEAEA 100%);
  --sm-modal-header-bevel: 0 2px 6px rgba(0, 0, 0, 0.13), inset 0 1px 0 #FFFFFF;
  --sm-modal-footer-bg: linear-gradient(180deg, #F6F6F6 0%, #ECECEC 100%);
  --sm-modal-footer-bevel: 0 -2px 6px rgba(0, 0, 0, 0.05), inset 0 1px 0 #FFFFFF;
  --sm-mask-bg: rgba(0, 0, 0, 0.61);
  --sm-topbar-shadow: 0 2px 6px rgba(0, 0, 0, 0.065), inset 0 1px 0 #FFFFFF;
  --sm-card-shadow: 0 1px 2px rgba(0, 0, 0, 0.085), 0 3px 8px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  --sm-card-shadow-hover: 0 2px 5px rgba(0, 0, 0, 0.10), 0 8px 18px rgba(0, 0, 0, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.96);
  --sm-modal-shadow: 0 5px 10px rgba(0, 0, 0, 0.06), 0 5px 5px rgba(0, 0, 0, 0.08), 0 7px 10px rgba(0, 0, 0, 0.10), 0 22px 26px rgba(0, 0, 0, 0.18);
  --sm-recess-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);

  /* Buttons */
  --sm-btn-default-bg: linear-gradient(180deg, #FDFDFD 0%, #F2F2F2 100%);
  --sm-btn-default-hover: linear-gradient(180deg, #FFFFFF 0%, #EBEBEB 100%);
  --sm-btn-default-active: linear-gradient(180deg, #E8E8E8 0%, #F2F2F2 100%);
  --sm-btn-default-border: #D3D3D3;
  --sm-btn-default-border-hover: #BFBFBF;
  --sm-btn-default-text: #4E4E4E;
  --sm-btn-default-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 1px 1.5px rgba(0, 0, 0, 0.045);

  /* Authentic 2016 Smartisan Store Sapphire Pillow Button (.blue-main-btn) */
  --sm-btn-primary-bg: linear-gradient(180deg, #739FE1 0%, #5F7ED7 100%);
  --sm-btn-primary-hover: linear-gradient(180deg, #6B94D8 0%, #5472CA 100%);
  --sm-btn-primary-active: linear-gradient(180deg, #5270C4 0%, #5F7ED7 100%);
  --sm-btn-primary-border: #486CB5;
  --sm-btn-primary-shadow: inset 0 1px 3px #92B6EC, inset 0 0 2px #627DCA, inset 0 -2px 3px #4C69B8, 0 1px 2px rgba(42, 71, 148, 0.22);
  --sm-btn-primary-shadow-hover: inset 0 1px 3px #83A9E1, inset 0 0 2px #627DCA, inset 0 -2px 3px #5A77C7, inset 0 0 100px rgba(48, 77, 147, 0.22);
  --sm-btn-primary-shadow-active: inset 0 2px 5px #3D67A5, inset 0 0 2px #627DCA, inset 0 0 100px rgba(25, 108, 232, 0.30);

  --sm-btn-disabled-bg: #F3F3F2;
  --sm-btn-disabled-border: #E0DFDD;
  --sm-btn-disabled-text: #B0B0B0;
  --sm-btn-primary-disabled-bg: linear-gradient(180deg, #B8B8B8 0%, #A9A9A9 100%);
  --sm-btn-primary-disabled-border: #A3A3A3;
  --sm-btn-primary-disabled-text: #FFFFFF;

  /* Alerts & Tags */
  --sm-info-bg: #EFF4FF;
  --sm-info-border: #C5D8FA;
  --sm-success-bg: #F0FAF2;
  --sm-success-border: #B7E2C2;
  --sm-warning-bg: #FFF8EB;
  --sm-warning-border: #F2D6A2;
  --sm-danger-bg: #FFF1F0;
  --sm-danger-border: #F5C0BE;
  --sm-tag-bg: #F3F4F6;
  --sm-tag-text: #575B66;

  /* Typography & Radii */
  --sm-font-sans: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft Yahei", system-ui, sans-serif;
  --sm-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --sm-radius-sm: 5px;
  --sm-radius-md: 8px;
  --sm-radius-lg: 10px;
  --sm-radius-modal: 12px;
}

/* Authentic Smartisan Notes v4.3 Warm-Neutral Carbon Charcoal Dark Mode */
:root[data-theme="dark"],
:root[theme-mode="dark"] {
  color-scheme: dark;

  --sm-brand: #6084D8;
  --sm-brand-hover: #7295E6;
  --sm-brand-active: #4F72C6;
  --sm-brand-soft: rgba(111, 145, 224, 0.15);
  --sm-brand-ring: rgba(111, 145, 224, 0.28);
  --sm-blue: #6F91E0;
  --sm-os-blue: #6F91E0;
  --sm-success: #63B574;
  --sm-warning: #D49A3A;
  --sm-danger: #D95B57;
  --sm-brass: #BEA17A;
  --sm-brass-bg: #2C2921;

  --sm-bg-canvas: #111112;
  --sm-bg-chrome: #1C1A1D;
  --sm-bg-topbar: #1C1A1D;
  --sm-bg-surface: #1A181C;
  --sm-bg-elevated: #1C1A1D;
  --sm-bg-modal: #232124;
  --sm-bg-recessed: #151317;
  --sm-bg-input: #161417;
  --sm-bg-sidebar: linear-gradient(180deg, #111013 0%, #0A090B 100%);

  --sm-chrome-border: #28262B;
  --sm-border: #2B292E;
  --sm-border-hover: #3F3C44;
  --sm-border-subtle: #252328;
  --sm-card-border: #2B292E;
  --sm-input-border: #2F2D33;
  --sm-sidebar-border: #232126;

  --sm-text: #D8D6DA;
  --sm-text-heading: #E6E4E8;
  --sm-text-secondary: #9A989D;
  --sm-text-muted: #66646A;
  --sm-sidebar-text: #E2E0E5;
  --sm-sidebar-text-muted: #8E8C92;

  --sm-card-header-bg: linear-gradient(180deg, #232126 0%, #1D1B20 100%);
  --sm-table-header-bg: #18161A;
  --sm-table-row-hover: #232127;
  --sm-modal-header-bg: linear-gradient(180deg, #2A282F 0%, #222026 100%);
  --sm-modal-header-bevel: 0 2px 8px rgba(0, 0, 0, 0.44), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --sm-modal-footer-bg: linear-gradient(180deg, #211F25 0%, #1B191E 100%);
  --sm-modal-footer-bevel: 0 -2px 8px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --sm-mask-bg: rgba(6, 5, 8, 0.72);
  --sm-topbar-shadow: 0 2px 10px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  --sm-card-shadow: 0 2px 10px rgba(0, 0, 0, 0.36);
  --sm-card-shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.48), 0 1px 3px rgba(0, 0, 0, 0.34);
  --sm-modal-shadow: 0 8px 20px rgba(0, 0, 0, 0.46), 0 22px 50px rgba(0, 0, 0, 0.64), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --sm-recess-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.42);

  --sm-btn-default-bg: linear-gradient(180deg, #28262C 0%, #211F25 100%);
  --sm-btn-default-hover: linear-gradient(180deg, #312E36 0%, #28262C 100%);
  --sm-btn-default-active: linear-gradient(180deg, #1E1C21 0%, #242228 100%);
  --sm-btn-default-border: #35323A;
  --sm-btn-default-border-hover: #47434E;
  --sm-btn-default-text: #D4D2D7;
  --sm-btn-default-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 1px 2px rgba(0, 0, 0, 0.30);

  --sm-btn-primary-bg: linear-gradient(180deg, #6E93DF 0%, #5778CC 100%);
  --sm-btn-primary-hover: linear-gradient(180deg, #799DE8 0%, #6082D6 100%);
  --sm-btn-primary-active: linear-gradient(180deg, #4D6FC0 0%, #5A7DD1 100%);
  --sm-btn-primary-border: #4868B6;
  --sm-btn-primary-shadow: inset 0 1px 3px rgba(164, 194, 248, 0.42), inset 0 0 2px rgba(98, 125, 202, 0.6), inset 0 -2px 3px rgba(45, 70, 138, 0.55), 0 1px 3px rgba(0, 0, 0, 0.42);
  --sm-btn-primary-shadow-hover: inset 0 1px 3px rgba(176, 204, 252, 0.48), inset 0 -2px 3px rgba(55, 82, 152, 0.55), 0 2px 6px rgba(0, 0, 0, 0.48);
  --sm-btn-primary-shadow-active: inset 0 2px 5px rgba(24, 42, 92, 0.72), inset 0 0 2px rgba(98, 125, 202, 0.55);

  --sm-btn-disabled-bg: #1F1D22;
  --sm-btn-disabled-border: #2C2A30;
  --sm-btn-disabled-text: #5E5C63;
  --sm-btn-primary-disabled-bg: #212F4C;
  --sm-btn-primary-disabled-border: #2A3B5E;
  --sm-btn-primary-disabled-text: #69768E;

  --sm-info-bg: #1A202D;
  --sm-info-border: #2A3854;
  --sm-success-bg: #19261D;
  --sm-success-border: #294532;
  --sm-warning-bg: #272118;
  --sm-warning-border: #4A3C24;
  --sm-danger-bg: #291A1C;
  --sm-danger-border: #4F282C;
  --sm-tag-bg: #25232A;
  --sm-tag-text: #C6C4CA;
}

/* ── Base Reset & Canvas Surfaces ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--sm-bg-canvas);
  color: var(--sm-text);
  font-family: var(--sm-font-sans);
  font-size: 14px;
  line-height: 1.65;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  text-decoration: underline;
}

.sm-canvas {
  background-color: var(--sm-bg-canvas);
  background-image: var(--sm-linen-texture);
  background-repeat: repeat;
  background-size: 256px 256px;
  background-position: top left;
}

:root[data-theme="dark"] .sm-canvas,
:root[theme-mode="dark"] .sm-canvas {
  background-color: #111112;
  background-image: var(--sm-dark-ribbed-texture);
  background-size: 224px 224px;
}

.sm-canvas-grille {
  background-color: var(--sm-bg-canvas);
  background-image: var(--sm-grille-texture);
  background-repeat: repeat;
  background-position: top center;
}

:root[data-theme="dark"] .sm-canvas-grille,
:root[theme-mode="dark"] .sm-canvas-grille {
  background-color: #111112;
  background-image: var(--sm-dark-ribbed-texture);
  background-size: 224px 224px;
}

.sm-container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px clamp(16px, 3vw, 32px);
}

/* ── Brushed-Silver / Matte-Carbon Sticky Topbar ─────────────────────────── */
.sm-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 54px;
  background: var(--sm-bg-topbar);
  border-bottom: 1px solid var(--sm-chrome-border);
  box-shadow: var(--sm-topbar-shadow);
}

.sm-topbar-inner {
  height: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 32px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.sm-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--sm-text-heading);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.015em;
  text-decoration: none;
}

.sm-brand:hover { text-decoration: none; }

.sm-brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  color: #1A1C20;
  background: radial-gradient(circle at 35% 28%, #FFFFFF 0%, #E0E2E7 58%, #BCBEC5 100%);
  border: 1px solid rgba(0, 0, 0, 0.16);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18), inset 0 1px 0 #FFFFFF;
}

.sm-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.sm-nav a {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 7px;
  color: var(--sm-text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease;
}

.sm-nav a:hover,
.sm-nav a.is-active,
.sm-nav .current-menu-item > a {
  background: var(--sm-brand-soft);
  color: var(--sm-text-heading);
  font-weight: 600;
}

/* ── Iconic Jet-Black Smartisan Sidebar ──────────────────────────────────── */
.sm-shell {
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  min-height: 100dvh;
}

.sm-sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 20px 12px 14px;
  background: var(--sm-bg-sidebar);
  border-right: 1px solid var(--sm-sidebar-border);
  color: var(--sm-sidebar-text);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sm-sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.sm-sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--sm-sidebar-text-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease;
}

.sm-sidebar-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #FFFFFF;
  text-decoration: none;
}

.sm-sidebar-item.is-active {
  background: linear-gradient(180deg, #2A2830 0%, #1F1D24 100%);
  border-color: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 1px 3px rgba(0, 0, 0, 0.36);
}

/* ── Die-Cut Tactile Paper Cards & Grouped Lists ─────────────────────────── */
.sm-card {
  background: var(--sm-bg-elevated);
  border: 1px solid var(--sm-card-border);
  border-radius: var(--sm-radius-lg);
  box-shadow: var(--sm-card-shadow);
  overflow: hidden;
}

.sm-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 12px 24px;
  background: var(--sm-card-header-bg);
  border-bottom: 1px solid var(--sm-border-subtle);
  color: var(--sm-text-secondary);
  font-size: 14.5px;
  font-weight: 600;
}

.sm-card-body {
  padding: 20px 24px;
}

.sm-card-flush > .sm-card-body,
.sm-card:has(> .sm-table-wrap) > .sm-card-body {
  padding: 0;
}

.sm-card-footer {
  padding: 12px 24px;
  background: var(--sm-bg-surface);
  border-top: 1px solid var(--sm-border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Smartisan OS / Smartisan Notes Grouped Setting Rows */
.sm-list-group {
  background: var(--sm-bg-elevated);
  border: 1px solid var(--sm-card-border);
  border-radius: var(--sm-radius-lg);
  box-shadow: var(--sm-card-shadow);
  overflow: hidden;
}

.sm-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 20px;
}

.sm-list-row + .sm-list-row {
  border-top: 1px solid var(--sm-border-subtle);
}

.sm-list-row-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--sm-text-heading);
}

.sm-list-row-desc {
  font-size: 12.5px;
  color: var(--sm-text-secondary);
  margin-top: 2px;
}

/* ── Smartisan Tactile Buttons ───────────────────────────────────────────── */
.sm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 6px;
  border: 1px solid var(--sm-btn-default-border);
  background: var(--sm-btn-default-bg);
  color: var(--sm-btn-default-text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--sm-btn-default-shadow);
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease, transform 80ms ease;
}

.sm-btn:hover:not(:disabled) {
  background: var(--sm-btn-default-hover);
  border-color: var(--sm-btn-default-border-hover);
  color: var(--sm-text-heading);
  text-decoration: none;
}

.sm-btn:active:not(:disabled) {
  background: var(--sm-btn-default-active);
  transform: translateY(0.5px);
}

.sm-btn-primary {
  background: var(--sm-btn-primary-bg);
  border-color: var(--sm-btn-primary-border);
  color: #FFFFFF;
  text-shadow: 0 -1px 0 rgba(28, 52, 114, 0.32);
  box-shadow: var(--sm-btn-primary-shadow);
}

.sm-btn-primary:hover:not(:disabled) {
  background: var(--sm-btn-primary-hover);
  border-color: var(--sm-brand-hover);
  color: #FFFFFF;
}

.sm-btn-primary:active:not(:disabled) {
  background: var(--sm-btn-primary-active);
}

.sm-btn-danger {
  background: linear-gradient(180deg, #DC514C 0%, #C33833 100%);
  border-color: #AE2F2B;
  color: #FFFFFF;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 1px 2px rgba(174, 47, 43, 0.26);
}

.sm-btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--sm-text-secondary);
  box-shadow: none;
}

.sm-btn-ghost:hover:not(:disabled) {
  background: var(--sm-brand-soft);
  border-color: transparent;
  color: var(--sm-text-heading);
}

.sm-btn:disabled,
.sm-btn.is-disabled {
  background: var(--sm-btn-disabled-bg);
  border-color: var(--sm-btn-disabled-border);
  color: var(--sm-btn-disabled-text);
  box-shadow: none;
  text-shadow: none;
  cursor: not-allowed;
}

.sm-btn-primary:disabled,
.sm-btn-primary.is-disabled {
  background: var(--sm-btn-primary-disabled-bg);
  border-color: var(--sm-btn-primary-disabled-border);
  color: var(--sm-btn-primary-disabled-text);
}

.sm-btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.sm-btn-lg { height: 42px; padding: 0 20px; font-size: 15px; }

/* ── Segmented Control (e.g. 浅色 / 深色 / 跟随系统) ──────────────────────── */
.sm-segmented {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  gap: 2px;
  border-radius: 7px;
  background: var(--sm-bg-recessed);
  border: 1px solid var(--sm-border-subtle);
}

.sm-segmented-btn {
  height: 28px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--sm-text-secondary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.sm-segmented-btn:hover {
  color: var(--sm-text-heading);
}

.sm-segmented-btn.is-active,
.sm-segmented-btn[aria-pressed="true"] {
  background: var(--sm-btn-primary-bg);
  border-color: var(--sm-btn-primary-border);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: var(--sm-btn-primary-shadow);
}

/* ── Authentic Smartisan OS Porcelain + Blue-Dot Hardware Toggle Switch ──── */
.sm-switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  margin: 0;
  border-radius: 999px;
  cursor: pointer;
  vertical-align: middle;
  background: linear-gradient(180deg, #F0F0F0 0%, #FCFCFC 100%);
  border: 1px solid #D9D9D9;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.11);
  transition: border-color 160ms ease, background 160ms ease;
}

/* Indicator dot: right (gray) when OFF, left (glowing Smartisan Blue) when ON */
.sm-switch::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.08);
  pointer-events: none;
  transition: background 160ms ease, box-shadow 160ms ease;
}

/* Raised tactile spherical knob */
.sm-switch::before {
  content: '';
  position: absolute;
  top: 1px;
  left: 1px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(180deg, #FFFFFF 0%, #F3F3F3 100%);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.22), 0 1px 2px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.95);
  transition: transform 180ms cubic-bezier(0.25, 0.8, 0.25, 1);
  z-index: 1;
}

.sm-switch:checked::before {
  transform: translateX(22px);
}

.sm-switch:checked::after {
  left: 8px;
  right: auto;
  background: radial-gradient(circle at 38% 34%, #9AB8FF 0%, #7496EE 62%, #597FE0 100%);
  box-shadow: 0 0 4px rgba(116, 150, 238, 0.50);
}

:root[data-theme="dark"] .sm-switch,
:root[theme-mode="dark"] .sm-switch {
  background: linear-gradient(180deg, #161418 0%, #211F25 100%);
  border-color: #35323B;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.52);
}

:root[data-theme="dark"] .sm-switch::after,
:root[theme-mode="dark"] .sm-switch::after {
  background: rgba(255, 255, 255, 0.16);
}

:root[data-theme="dark"] .sm-switch:checked,
:root[theme-mode="dark"] .sm-switch:checked {
  background: linear-gradient(180deg, #1C2334 0%, #232C42 100%);
  border-color: #3E558A;
}

:root[data-theme="dark"] .sm-switch:checked::after,
:root[theme-mode="dark"] .sm-switch:checked::after {
  background: radial-gradient(circle at 38% 34%, #A8C3FA 0%, #6F91E0 62%, #5578CC 100%);
  box-shadow: 0 0 6px rgba(111, 145, 224, 0.72);
}

:root[data-theme="dark"] .sm-switch::before,
:root[theme-mode="dark"] .sm-switch::before {
  background: linear-gradient(180deg, #E8E6EB 0%, #C7C4CC 100%);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

/* ── Authentic Smartisan OS 20px White-Knob Tactile Slider ───────────────── */
.sm-slider {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  background: linear-gradient(
    to right,
    var(--sm-brand) 0%,
    var(--sm-brand) var(--sm-slider-pct, 50%),
    var(--sm-border) var(--sm-slider-pct, 50%),
    var(--sm-border) 100%
  );
}

.sm-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(180deg, #FFFFFF 0%, #F2F2F2 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.10), inset 0 1px 0 #FFFFFF;
  cursor: pointer;
}

.sm-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #FFFFFF 0%, #F2F2F2 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.10), inset 0 1px 0 #FFFFFF;
  cursor: pointer;
}

:root[data-theme="dark"] .sm-slider::-webkit-slider-thumb,
:root[theme-mode="dark"] .sm-slider::-webkit-slider-thumb {
  background: linear-gradient(180deg, #EAE8ED 0%, #CBC8D1 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.20);
}

/* ── Recessed Crisp Form Inputs ──────────────────────────────────────────── */
.sm-input,
.sm-textarea,
.sm-select {
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--sm-input-border);
  background: var(--sm-bg-input);
  color: var(--sm-text);
  font-family: inherit;
  font-size: 13.5px;
  box-shadow: var(--sm-recess-shadow);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.sm-input,
.sm-select { height: 36px; }

.sm-input::placeholder,
.sm-textarea::placeholder {
  color: var(--sm-text-muted);
}

.sm-input:focus,
.sm-textarea:focus,
.sm-select:focus {
  border-color: var(--sm-blue);
  box-shadow: 0 0 0 2.5px var(--sm-brand-ring);
}

/* ── Flush Card-Integrated Tables ────────────────────────────────────────── */
.sm-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.sm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.sm-table thead th {
  padding: 10px 18px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--sm-text-muted);
  background: var(--sm-table-header-bg);
  border-bottom: 1px solid var(--sm-border-subtle);
  white-space: nowrap;
}

.sm-table tbody td {
  padding: 13px 18px;
  color: var(--sm-text);
  border-bottom: 1px solid var(--sm-border-subtle);
  vertical-align: middle;
  transition: background 120ms ease;
}

.sm-table tbody tr:hover td {
  background: var(--sm-table-row-hover);
}

.sm-table th:first-child,
.sm-table td:first-child { padding-left: 24px; }

.sm-table th:last-child,
.sm-table td:last-child { padding-right: 24px; }

.sm-table tbody tr:last-child td { border-bottom: 0; }

.sm-table .is-right { text-align: right; }

/* Restrained Dots & Pills */
.sm-dot-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--sm-text-secondary);
}

.sm-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sm-blue);
  flex-shrink: 0;
}

.sm-tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 5px;
  background: var(--sm-tag-bg);
  border: 1px solid var(--sm-border-subtle);
  color: var(--sm-tag-text);
  font-size: 12px;
  font-weight: 500;
}

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.sm-alert {
  padding: 13px 16px;
  border-radius: var(--sm-radius-md);
  border: 1px solid var(--sm-info-border);
  background: var(--sm-info-bg);
  color: var(--sm-text);
  font-size: 13px;
}

.sm-alert.is-success { background: var(--sm-success-bg); border-color: var(--sm-success-border); }
.sm-alert.is-warning { background: var(--sm-warning-bg); border-color: var(--sm-warning-border); }
.sm-alert.is-danger { background: var(--sm-danger-bg); border-color: var(--sm-danger-border); }
.sm-alert-title { font-weight: 600; color: var(--sm-text-heading); margin-bottom: 2px; }
.sm-alert-desc { color: var(--sm-text-secondary); }

/* ── Full-Bleed Smartisan Modal (Elevated #232124 in Dark Mode) ──────────── */
.sm-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  place-items: center;
  padding: 24px;
  background: var(--sm-mask-bg);
  backdrop-filter: blur(2px);
}

.sm-modal-backdrop.is-open { display: grid; }

.sm-modal {
  width: min(560px, 100%);
  max-height: calc(100dvh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--sm-bg-modal);
  border: 1px solid var(--sm-border);
  border-radius: var(--sm-radius-modal);
  box-shadow: var(--sm-modal-shadow);
  overflow: hidden;
}

.sm-modal-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 15px 18px 15px 28px;
  background: var(--sm-modal-header-bg);
  border-bottom: 1px solid var(--sm-border);
  box-shadow: var(--sm-modal-header-bevel);
}

.sm-modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 400;
  color: var(--sm-text-secondary);
}

:root[data-theme="dark"] .sm-modal-title,
:root[theme-mode="dark"] .sm-modal-title {
  color: var(--sm-text-heading);
}

.sm-modal-body {
  position: relative;
  z-index: 1;
  padding: 26px 28px 28px;
  overflow-y: auto;
  color: var(--sm-text);
}

.sm-modal-footer {
  position: relative;
  z-index: 2;
  padding: 14px 20px;
  background: var(--sm-modal-footer-bg);
  border-top: 1px solid var(--sm-border);
  box-shadow: var(--sm-modal-footer-bevel);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Floating Toast Notifications ────────────────────────────────────────── */
.sm-toast-region {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.sm-toast {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 8px;
  background: var(--sm-bg-modal);
  border: 1px solid var(--sm-border);
  color: var(--sm-text-heading);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--sm-modal-shadow);
  animation: sm-toast-in 180ms ease;
}

@keyframes sm-toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── WordPress Blog / Article / Archive Ready Utilities ──────────────────── */
.sm-post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.sm-post-card {
  display: flex;
  flex-direction: column;
  background: var(--sm-bg-elevated);
  border: 1px solid var(--sm-card-border);
  border-radius: var(--sm-radius-lg);
  box-shadow: var(--sm-card-shadow);
  overflow: hidden;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.sm-post-card:hover {
  transform: translateY(-2px);
  border-color: var(--sm-border-hover);
  box-shadow: var(--sm-card-shadow-hover);
}

.sm-post-cover {
  aspect-ratio: 16 / 9;
  background: var(--sm-bg-surface);
  overflow: hidden;
  border-bottom: 1px solid var(--sm-border-subtle);
}

.sm-post-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sm-post-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.sm-post-title {
  margin: 0;
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--sm-text-heading);
}

.sm-post-title a { color: inherit; text-decoration: none; }
.sm-post-title a:hover { color: var(--sm-blue); }

.sm-post-excerpt {
  margin: 0;
  font-size: 13.5px;
  color: var(--sm-text-secondary);
  line-height: 1.65;
}

.sm-post-meta {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--sm-border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--sm-text-muted);
}

/* Editorial Reading Typography (.sm-article / WP .entry-content) */
.sm-article,
.entry-content {
  color: var(--sm-text);
  font-size: 15px;
  line-height: 1.85;
}

.sm-article h1, .sm-article h2, .sm-article h3,
.entry-content h1, .entry-content h2, .entry-content h3 {
  color: var(--sm-text-heading);
  line-height: 1.35;
  margin-top: 1.6em;
  margin-bottom: 0.6em;
}

.sm-article blockquote,
.entry-content blockquote {
  margin: 1.4em 0;
  padding: 12px 18px;
  border-left: 3px solid var(--sm-brass);
  background: var(--sm-brass-bg);
  border-radius: 0 8px 8px 0;
  color: var(--sm-text);
}

.sm-article pre,
.entry-content pre {
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--sm-bg-recessed);
  border: 1px solid var(--sm-border-subtle);
  font-family: var(--sm-font-mono);
  font-size: 13px;
  overflow-x: auto;
}

.sm-article code,
.entry-content code {
  font-family: var(--sm-font-mono);
  font-size: 0.9em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--sm-tag-bg);
}

.sm-article pre code,
.entry-content pre code {
  padding: 0;
  background: transparent;
}

/* WordPress Pagination (.nav-links / .sm-pagination) */
.sm-pagination,
.navigation.pagination .nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 28px;
}

.sm-pagination a,
.sm-pagination span,
.navigation.pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--sm-btn-default-border);
  background: var(--sm-btn-default-bg);
  color: var(--sm-text);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.sm-pagination .is-active,
.navigation.pagination .page-numbers.current {
  background: var(--sm-btn-primary-bg);
  border-color: var(--sm-btn-primary-border);
  color: #FFFFFF;
}

.sm-footer {
  margin-top: 40px;
  padding: 20px clamp(16px, 3vw, 32px);
  background: var(--sm-bg-chrome);
  border-top: 1px solid var(--sm-chrome-border);
  color: var(--sm-text-muted);
  font-size: 12.5px;
}

.sm-footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* ── Smartisan Notes Debossed Translucent Empty Watermark ────────────────── */
.sm-empty-watermark {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 52px 24px 44px;
  background: transparent;
  border: 0;
  box-shadow: none;
  user-select: none;
}

.sm-empty-watermark-icon {
  width: 60px;
  height: 60px;
  margin-bottom: 14px;
  color: rgba(30, 32, 36, 0.22);
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.82));
}

.sm-empty-watermark-title {
  font-size: 15.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(30, 32, 36, 0.34);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.84);
  line-height: 1.5;
}

.sm-empty-watermark-desc {
  margin-top: 6px;
  font-size: 12.5px;
  color: rgba(30, 32, 36, 0.28);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.78);
  line-height: 1.65;
}

:root[data-theme="dark"] .sm-empty-watermark-icon,
:root[theme-mode="dark"] .sm-empty-watermark-icon {
  color: rgba(255, 255, 255, 0.20);
  filter: drop-shadow(0 -1px 0 rgba(0, 0, 0, 0.75));
}

:root[data-theme="dark"] .sm-empty-watermark-title,
:root[theme-mode="dark"] .sm-empty-watermark-title {
  color: rgba(255, 255, 255, 0.32);
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.75);
}

:root[data-theme="dark"] .sm-empty-watermark-desc,
:root[theme-mode="dark"] .sm-empty-watermark-desc {
  color: rgba(255, 255, 255, 0.24);
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.70);
}
