/* ===================================
   療育センターエコルド 職員用マニュアル
   共通スタイルシート
=================================== */

/* --- Google Fonts & Variables --- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700;900&display=swap');

:root {
  --primary:       #29ABE2;
  --primary-dark:  #1a8bbf;
  --primary-light: #d6f0fa;
  --secondary:     #39B54A;
  --secondary-dark:#2a8a38;
  --accent:        #F7931E;
  --danger:        #e74c3c;
  --warning:       #f39c12;
  --info:          #3498db;
  --success:       #27ae60;

  --dept-child:    #FF7BAC;  /* 児童発達支援 */
  --dept-after:    #7B68EE;  /* 放課後等デイサービス */
  --dept-common:   #29ABE2;  /* 共通 */

  --bg:            #f4f8fb;
  --bg-white:      #ffffff;
  --bg-card:       #ffffff;
  --border:        #dde6ee;
  --text:          #2c3e50;
  --text-light:    #6b7e92;
  --text-muted:    #95a5a6;

  --radius-sm:     6px;
  --radius:        12px;
  --radius-lg:     20px;
  --shadow-sm:     0 2px 8px rgba(0,0,0,.06);
  --shadow:        0 4px 20px rgba(0,0,0,.08);
  --shadow-lg:     0 8px 40px rgba(0,0,0,.12);

  --header-h:      64px;
  --sidebar-w:     260px;
  --transition:    .2s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; }

ul, ol { list-style: none; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }

/* ===================================
   HEADER
=================================== */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--bg-white);
  border-bottom: 2px solid var(--primary-light);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 1000;
  gap: 16px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.header-logo img {
  height: 40px;
  width: auto;
}

.header-logo-icon {
  font-size: 1.8rem;
  line-height: 1;
  color: var(--secondary);
}

.header-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.header-logo-text .site-name {
  font-size: .9rem;
  font-weight: 700;
  color: var(--primary);
}

.header-logo-text .site-sub {
  font-size: .65rem;
  color: var(--text-light);
  letter-spacing: .04em;
}

.header-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.header-search input {
  width: 100%;
  padding: 9px 16px 9px 40px;
  border: 2px solid var(--border);
  border-radius: 24px;
  font-size: .9rem;
  font-family: inherit;
  background: var(--bg);
  transition: border-color var(--transition);
  outline: none;
}

.header-search input:focus {
  border-color: var(--primary);
  background: var(--bg-white);
}

.header-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: .95rem;
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--primary-light);
  border-radius: 24px;
  font-size: .82rem;
  color: var(--primary-dark);
  font-weight: 500;
}

.header-user-info .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.4rem;
  color: var(--text);
  padding: 4px;
}

/* ===================================
   SIDEBAR
=================================== */
.site-sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--header-h));
  background: var(--bg-white);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 900;
  transition: transform var(--transition);
  padding: 16px 0 40px;
}

.sidebar-section {
  padding: 8px 0;
}

.sidebar-section-title {
  font-size: .7rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 6px 20px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: .88rem;
  color: var(--text);
  font-weight: 500;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-left-color: var(--primary);
}

.sidebar-nav a.active {
  background: var(--primary-light);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 700;
}

.sidebar-nav a .nav-icon {
  width: 22px;
  text-align: center;
  font-size: 1rem;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 16px;
}

.sidebar-dept-badge {
  display: inline-block;
  font-size: .65rem;
  padding: 2px 6px;
  border-radius: 8px;
  font-weight: 700;
  margin-left: auto;
}

.badge-child { background: #fce4ec; color: var(--dept-child); }
.badge-after { background: #ede7f6; color: var(--dept-after); }
.badge-common { background: var(--primary-light); color: var(--primary); }

/* ===================================
   MAIN LAYOUT
=================================== */
.page-wrapper {
  margin-top: var(--header-h);
  margin-left: var(--sidebar-w);
  min-height: calc(100vh - var(--header-h));
  transition: margin-left var(--transition);
}

.page-content {
  padding: 28px 32px;
  max-width: 1200px;
}

/* ===================================
   BUTTONS
=================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 600;
  font-family: inherit;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}

.btn-secondary {
  background: var(--secondary);
  color: #fff;
  border-color: var(--secondary);
}
.btn-secondary:hover {
  background: var(--secondary-dark);
  border-color: var(--secondary-dark);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover {
  background: var(--primary-light);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover { opacity: .85; }

.btn-sm {
  padding: 5px 12px;
  font-size: .78rem;
}

.btn-lg {
  padding: 13px 28px;
  font-size: 1rem;
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ===================================
   CARDS
=================================== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 20px; }

/* Manual Cards */
.manual-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.manual-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}

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

.manual-card.priority-high::before { background: var(--danger); }
.manual-card.priority-medium::before { background: var(--warning); }
.manual-card.priority-low::before { background: var(--secondary); }

.manual-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.manual-card-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}

.manual-card-desc {
  font-size: .82rem;
  color: var(--text-light);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.manual-card-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.manual-card-meta {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ===================================
   BADGES & TAGS
=================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1;
}

.badge-dept-child {
  background: #fce4ec;
  color: #c2185b;
}

.badge-dept-after {
  background: #ede7f6;
  color: #512da8;
}

.badge-dept-common {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.badge-priority-high {
  background: #fdecea;
  color: var(--danger);
}

.badge-priority-medium {
  background: #fff8e1;
  color: #e67e22;
}

.badge-priority-low {
  background: #e8f5e9;
  color: var(--secondary-dark);
}

.badge-new {
  background: var(--accent);
  color: #fff;
}

/* ページUI用タグ（本文外・マニュアル一覧・詳細ヘッダー等で使用） */
/* ⚠️ 本文HTML内のタグは .tag/.tag-red 等で独自定義されているため、.tag はここでは定義しない */
.page-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: .7rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-light);
}

/* ===================================
   FORMS
=================================== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: .85rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--danger);
  margin-left: 4px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-white);
  transition: border-color var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(41,171,226,.12);
}

.form-control.is-error {
  border-color: var(--danger);
}

.form-hint {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: .78rem;
  color: var(--danger);
  margin-top: 4px;
}

/* Checkbox group */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-chip {
  display: none;
}

.checkbox-chip + label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 2px solid var(--border);
  border-radius: 24px;
  font-size: .82rem;
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 500;
}

.checkbox-chip + label:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.checkbox-chip:checked + label {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ===================================
   PAGE HEADERS
=================================== */
.page-header {
  margin-bottom: 28px;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: .88rem;
  color: var(--text-light);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.breadcrumb a {
  color: var(--primary);
}

.breadcrumb-sep { color: var(--border); }

/* ===================================
   GRID LAYOUTS
=================================== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

.manual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

/* ===================================
   STAT CARDS (Dashboard)
=================================== */
.stat-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-body {}
.stat-value {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--text);
  line-height: 1;
}
.stat-label {
  font-size: .78rem;
  color: var(--text-light);
  margin-top: 2px;
}

/* ===================================
   FILTER BAR
=================================== */
.filter-bar {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.filter-label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-light);
  white-space: nowrap;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  font-size: .78rem;
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 500;
  color: var(--text-light);
  font-family: inherit;
}

.filter-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.filter-chip.dept-child.active  { background: var(--dept-child); border-color: var(--dept-child); }
.filter-chip.dept-after.active  { background: var(--dept-after); border-color: var(--dept-after); }

/* ===================================
   ALERTS & NOTICES
=================================== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.alert-info    { background: #e3f2fd; color: #1565c0; border-left: 4px solid #1565c0; }
.alert-success { background: #e8f5e9; color: #2e7d32; border-left: 4px solid #2e7d32; }
.alert-warning { background: #fff8e1; color: #e65100; border-left: 4px solid #e65100; }
.alert-danger  { background: #fdecea; color: #c62828; border-left: 4px solid #c62828; }

/* ===================================
   MODALS
=================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform var(--transition);
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1000px; }

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  line-height: 1;
}

.modal-close:hover { color: var(--text); }

.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ===================================
   TOAST NOTIFICATIONS
=================================== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 500;
  color: #fff;
  min-width: 240px;
  max-width: 360px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideInRight .3s ease;
}

.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
.toast-info    { background: var(--info); }
.toast-warning { background: var(--warning); }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateX(100%); }
}

/* ===================================
   LOADING
=================================== */
.loading-spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.7);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: .9rem;
  color: var(--text-light);
}

.loading-overlay .loading-spinner {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===================================
   EMPTY STATE
=================================== */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  display: block;
}

.empty-state-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 6px;
}

.empty-state-text {
  font-size: .85rem;
}

/* ===================================
   PRIORITY INDICATOR
=================================== */
.priority-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}
.priority-dot-high   { background: var(--danger); }
.priority-dot-medium { background: var(--warning); }
.priority-dot-low    { background: var(--secondary); }

/* ===================================
   MANUAL DETAIL CONTENT
=================================== */
.manual-content {
  line-height: 1.8;
  font-size: .95rem;
}

.manual-content h1 { font-size: 1.5rem; font-weight: 900; margin: 24px 0 12px; color: var(--primary); }
.manual-content h2 { font-size: 1.2rem; font-weight: 700; margin: 20px 0 10px; padding-left: 10px; border-left: 4px solid var(--primary); color: var(--text); }
.manual-content h3 { font-size: 1rem; font-weight: 700; margin: 16px 0 8px; color: var(--text); }

/* ===== 各マニュアル専用ヘッダー内のh2/h3を保護（.manual-content h2の上書きを防ぐ） ===== */
.manual-content .ps-section-header h2,
.manual-content .ac-chapter-header h2,
.manual-content .tg-section-header h2 { color: #1a1a2e !important; border-left: none !important; padding-left: 0 !important; margin: 0 !important; font-size: inherit !important; }
/* 虐待防止マニュアル 紺色チャプターヘッダー内h2は白固定 */
.manual-content .ab-chapter-header h2 { color: #ffffff !important; border-left: none !important; padding-left: 0 !important; margin: 0 !important; font-size: inherit !important; }
.manual-content p  { margin-bottom: 12px; }
.manual-content ul, .manual-content ol { margin: 12px 0 12px 24px; }
.manual-content li { margin-bottom: 6px; }
.manual-content ul { list-style: disc; }
.manual-content ol { list-style: decimal; }
.manual-content strong { color: var(--text); font-weight: 700; }
.manual-content em { color: var(--text-light); }
.manual-content blockquote {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 16px 0;
  font-size: .9rem;
  color: var(--primary-dark);
}
.manual-content .highlight-box {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin: 12px 0;
}
.manual-content .danger-box {
  background: #fdecea;
  border: 1px solid #ffcdd2;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin: 12px 0;
}
.manual-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: .88rem;
}
.manual-content th {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 10px 12px;
  font-weight: 700;
  border: 1px solid var(--border);
  text-align: left;
}
.manual-content td {
  padding: 8px 12px;
  border: 1px solid var(--border);
}
.manual-content tr:nth-child(even) td { background: var(--bg); }

/* インラインCSSデザイン（flow/child/link カードシステム）保護 */
.manual-content .flow-item,
.manual-content .flow-item * { border: none !important; padding: 0 !important; background: none !important; }
.manual-content .flow-item { display: flex !important; gap: 12px !important; padding: 8px 0 !important; border-bottom: 1px dashed #e0e0e0 !important; align-items: flex-start !important; }
.manual-content .flow-item:last-child { border-bottom: none !important; }
.manual-content .flow-time { min-width: 70px !important; font-weight: 700 !important; font-size: 0.95em !important; color: #555 !important; white-space: nowrap !important; padding-top: 0 !important; }
.manual-content .flow-task { flex: 1 !important; font-size: 0.97em !important; line-height: 1.6 !important; }
.manual-content .flow-body { padding: 16px 18px !important; }
.manual-content .child-body ul li,
.manual-content .link-item { border: none !important; background: none !important; }
.manual-content .link-item { display: flex !important; gap: 10px !important; padding: 9px 0 !important; border-bottom: 1px dashed #e0e0e0 !important; align-items: flex-start !important; font-size: 0.96em !important; line-height: 1.7 !important; }
.manual-content .link-item:last-child { border-bottom: none !important; }

/* ===================================
   RESPONSIVE
=================================== */
@media (max-width: 1024px) {
  .page-content { padding: 20px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .site-sidebar {
    width: 260px;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  .site-sidebar.open {
    transform: translateX(0);
  }

  .page-wrapper {
    margin-left: 0;
  }

  .hamburger { display: block; }

  .header-search { max-width: 200px; }
  .header-user-info .user-name { display: none; }

  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }

  .page-content { padding: 16px; }
  .page-title { font-size: 1.3rem; }

  .manual-grid { grid-template-columns: 1fr; }

  .filter-bar { gap: 8px; }
}

@media (max-width: 480px) {
  .grid-4 { grid-template-columns: 1fr; }
  .modal { margin: 10px; max-height: 95vh; }
}

/* ===================================
   PRINT
=================================== */
@media print {
  .site-header,
  .site-sidebar,
  .filter-bar,
  .btn,
  .breadcrumb,
  #toast-container { display: none !important; }

  .page-wrapper { margin: 0; }
  .page-content { padding: 0; }
  .manual-content { font-size: 11pt; line-height: 1.6; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}

/* ===================================
   AUTH PAGES
=================================== */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-light) 0%, #ffffff 50%, #e8f5e9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
}

.auth-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  padding: 32px 32px 28px;
  text-align: center;
  color: #fff;
}

.auth-header img {
  height: 64px;
  margin-bottom: 12px;
}

.auth-logo-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.18);
  border: 2px solid rgba(255,255,255,0.45);
  border-radius: 40px;
  padding: 6px 20px 6px 14px;
  margin-bottom: 14px;
}

.auth-logo-leaf {
  font-size: 1.6rem;
  line-height: 1;
  color: #a8e6a8;
}

.auth-logo-text-main {
  font-family: 'Arial Black', 'Arial', sans-serif;
  font-size: 1.5rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 2px;
  line-height: 1;
}

.auth-header-title {
  font-size: 1rem;
  font-weight: 700;
  opacity: .9;
}

.auth-header-sub {
  font-size: .8rem;
  opacity: .7;
  margin-top: 2px;
}

.auth-body { padding: 32px; }

.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  font-family: inherit;
}

.auth-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ===================================
   MY PAGE / PROFILE
=================================== */
.profile-header {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius);
  padding: 28px;
  color: #fff;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 900;
  flex-shrink: 0;
  border: 3px solid rgba(255,255,255,.5);
}

.profile-name {
  font-size: 1.4rem;
  font-weight: 900;
}

.profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.profile-badge {
  background: rgba(255,255,255,.25);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: .75rem;
  font-weight: 600;
}

/* ===================================
   SECTION TITLE DECORATIONS
=================================== */
.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ===================================
   UTILITY
=================================== */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.fw-bold { font-weight: 700; }
.fw-900  { font-weight: 900; }
.d-flex  { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.mb-8   { margin-bottom: 8px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* Overlay for mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 850;
}
.sidebar-overlay.open { display: block; }
