/* ============================================
   Design Check System v4 — Design System
   ============================================ */
:root {
  --c-primary:    #2563EB;
  --c-primary-h:  #1D4ED8;
  --c-danger:     #EF4444;
  --c-danger-h:   #DC2626;
  --c-success:    #10B981;
  --c-warning:    #F59E0B;
  --c-text:       #111827;
  --c-text-sub:   #4B5563;
  --c-text-muted: #9CA3AF;
  --c-border:     #E5E7EB;
  --c-bg:         #F3F4F6;
  --c-white:      #FFFFFF;
  --c-sidebar:    #1B2539;
  --c-sidebar-hover: rgba(255,255,255,.10);
  --c-sidebar-act:   rgba(255,255,255,.16);
  --r-sm: 4px; --r-md: 6px; --r-lg: 10px; --r-xl: 14px;
  --sh-sm: 0 1px 2px rgba(0,0,0,.06);
  --sh-md: 0 4px 12px rgba(0,0,0,.08);
  --sh-lg: 0 8px 30px rgba(0,0,0,.14);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --header-h: 54px;
  --sidebar-l: 224px;
  --sidebar-r: 380px;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; font-family: var(--font); color: var(--c-text); overflow: hidden; font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }

/* ---- Utilities ---- */
.full-width { width: 100%; }
.text-right { text-align: right; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px; border: 1px solid transparent; border-radius: var(--r-md);
  cursor: pointer; font-size: 13px; font-family: var(--font); font-weight: 500;
  text-decoration: none; transition: all .15s; white-space: nowrap; line-height: 1.4;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary  { background: var(--c-primary);  color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--c-primary-h); }
.btn-danger   { background: var(--c-danger);   color: #fff; }
.btn-danger:hover:not(:disabled)  { background: var(--c-danger-h); }
.btn-success  { background: var(--c-success);  color: #fff; }
.btn-success:hover:not(:disabled) { filter: brightness(.92); }
.btn-secondary { background: var(--c-white); color: var(--c-text); border-color: var(--c-border); }
.btn-secondary:hover:not(:disabled) { background: var(--c-bg); }
.btn-ghost    { background: transparent; color: var(--c-text-sub); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--c-bg); }
.btn-sm  { padding: 4px 10px; font-size: 12px; }
.btn-xs  { padding: 2px 8px;  font-size: 11px; border-radius: var(--r-sm); }

/* ---- Form ---- */
input[type="text"], input[type="url"], input[type="email"],
input[type="password"], input[type="number"], select, textarea {
  font-family: var(--font); font-size: 13px; color: var(--c-text);
  border: 1px solid var(--c-border); border-radius: var(--r-md);
  padding: 8px 10px; width: 100%; transition: border-color .15s, box-shadow .15s;
  background: var(--c-white);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
label { display: block; font-size: 12px; font-weight: 600; color: var(--c-text-sub); margin-bottom: 5px; }

/* ---- Status ---- */
.status-color-0 { color: #DC2626; font-weight: 700; }
.status-color-1 { color: #2563EB; font-weight: 700; }
.status-color-2 { color: #059669; font-weight: 700; }

/* ---- Alerts ---- */
.msg-success { color: #065F46; background: #ECFDF5; border: 1px solid #A7F3D0; padding: 10px 14px; border-radius: var(--r-md); margin-bottom: 14px; font-size: 13px; }
.msg-error   { color: #B91C1C; background: #FEF2F2; border: 1px solid #FECACA; padding: 10px 14px; border-radius: var(--r-md); margin-bottom: 14px; font-size: 13px; }
.error       { color: #B91C1C; font-size: 12px; }

/* ============================================
   Login
   ============================================ */
.login-body {
  background: linear-gradient(140deg, #1B2539 0%, #1e3a8a 60%, #2563EB 100%);
  display: flex; align-items: center; justify-content: center; overflow: auto;
}
.login-card {
  background: var(--c-white); width: 400px; padding: 48px 44px;
  border-radius: var(--r-xl); box-shadow: var(--sh-lg); animation: fadeUp .35s ease;
}
@keyframes fadeUp { from { opacity:0; transform:translateY(14px); } to { opacity:1; transform:none; } }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo-icon {
  width: 52px; height: 52px; background: var(--c-primary); border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center; margin-bottom: 14px;
}
.login-logo-icon svg { width: 28px; height: 28px; fill: #fff; }
.login-logo h1 { font-size: 18px; font-weight: 800; color: var(--c-text); margin: 0 0 4px; letter-spacing: -.02em; }
.login-logo p  { font-size: 12px; color: var(--c-text-muted); margin: 0; }
.login-field   { margin-bottom: 16px; }
.login-field input { font-size: 14px; padding: 11px 12px; }
.login-submit  { width: 100%; justify-content: center; padding: 11px; font-size: 14px; margin-top: 8px; }

/* ============================================
   App Shell
   ============================================ */
.app-container { display: flex; flex-direction: column; height: 100vh; }

header {
  background: var(--c-white); border-bottom: 1px solid var(--c-border);
  height: var(--header-h); padding: 0 20px;
  display: flex; justify-content: space-between; align-items: center;
  flex-shrink: 0; z-index: 100; box-shadow: var(--sh-sm);
}
.header-brand { font-weight: 800; font-size: 15px; letter-spacing: -.02em; color: var(--c-text); text-decoration: none; }
.header-left  { display: flex; align-items: center; gap: 10px; }
.header-right { display: flex; align-items: center; gap: 4px; }
.header-sep   { color: var(--c-border); font-size: 20px; margin: 0 2px; }
.header-page  { font-size: 14px; color: var(--c-text-sub); }
.header-nav-link {
  padding: 6px 10px; border-radius: var(--r-md); color: var(--c-text-sub);
  font-size: 13px; text-decoration: none; font-weight: 500; transition: background .15s, color .15s;
}
.header-nav-link:hover { background: var(--c-bg); color: var(--c-text); }
.header-user {
  font-size: 13px; font-weight: 600; color: var(--c-text-sub);
  padding: 6px 10px; border-radius: var(--r-md); background: var(--c-bg);
}
.header-divider { width: 1px; height: 20px; background: var(--c-border); margin: 0 4px; }

.workspace { display: flex; flex: 1; overflow: hidden; height: calc(100vh - var(--header-h)); }

/* ============================================
   Dashboard
   ============================================ */
.dashboard-scroll { flex: 1; overflow-y: auto; background: var(--c-bg); }
.dashboard-container { padding: 32px; max-width: 1080px; margin: 0 auto; }
.dashboard-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.dashboard-head h2 { font-size: 20px; font-weight: 800; margin: 0; letter-spacing: -.02em; }

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.project-card {
  background: var(--c-white); border: 1px solid var(--c-border); border-radius: var(--r-lg);
  padding: 22px; transition: box-shadow .2s, border-color .2s; display: flex; flex-direction: column;
}
.project-card:hover { box-shadow: var(--sh-md); border-color: #D1D5DB; }
.project-card-title { font-size: 15px; font-weight: 700; color: var(--c-text); margin: 0 0 6px; line-height: 1.4; }
.project-card-date  { font-size: 12px; color: var(--c-text-muted); margin-bottom: 16px; }
.project-card-actions { display: flex; gap: 8px; }

/* ============================================
   Detail — Left Sidebar
   ============================================ */
.sidebar-left {
  width: var(--sidebar-l); background: var(--c-sidebar);
  display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto;
}
.sidebar-left-header {
  padding: 14px 16px; font-size: 10px; font-weight: 700; letter-spacing: .08em;
  color: rgba(255,255,255,.35); text-transform: uppercase;
  border-bottom: 1px solid rgba(255,255,255,.06); flex-shrink: 0;
}
.page-list { list-style: none; padding: 8px; margin: 0; }
.page-item { border-radius: var(--r-md); margin-bottom: 2px; }
.page-item a {
  display: block; padding: 10px 12px; color: rgba(255,255,255,.72);
  text-decoration: none; transition: background .15s; border-radius: var(--r-md); font-size: 13px;
}
.page-item a:hover { background: var(--c-sidebar-hover); color: #fff; }
.page-item.active a { background: var(--c-sidebar-act); color: #fff; font-weight: 600; }
.page-meta { display: flex; gap: 8px; margin-top: 5px; flex-wrap: wrap; }
.page-meta span { font-size: 10px; font-weight: 600; }

/* ============================================
   Detail — Main Canvas
   ============================================ */
.main-area {
  flex: 1; min-width: 0; background: #3A3D42;
  display: flex; flex-direction: column; overflow: hidden; position: relative;
}
.main-scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  position: relative; padding: 24px;
}

/* ---- ステータスバー（表示倍率） ---- */
.zoom-bar {
  flex-shrink: 0; height: 34px; display: flex; align-items: center; gap: 10px;
  padding: 0 14px; background: #2A2D33; border-top: 1px solid rgba(255,255,255,.10);
  color: rgba(255,255,255,.68); font-size: 11px; user-select: none; z-index: 50;
}
.zoom-bar.disabled { opacity: .4; }
.zoom-bar-label { font-weight: 600; letter-spacing: .04em; white-space: nowrap; }
.zoom-slider {
  -webkit-appearance: none; appearance: none;
  width: 180px; height: 4px; padding: 0; border: none; border-radius: 2px;
  background: rgba(255,255,255,.22); cursor: pointer; flex-shrink: 0;
}
.zoom-slider:focus { outline: none; box-shadow: none; border-color: transparent; }
.zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 13px; height: 13px;
  border-radius: 50%; background: #fff; border: none; cursor: pointer;
}
.zoom-slider::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%; background: #fff; border: none; cursor: pointer;
}
.zoom-slider:disabled { cursor: not-allowed; }
.zoom-value {
  min-width: 38px; text-align: right; font-weight: 700; color: #fff;
  font-variant-numeric: tabular-nums;
}
.zoom-reset {
  background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.16);
  color: rgba(255,255,255,.75); font-family: var(--font); font-size: 11px;
  padding: 3px 9px; border-radius: var(--r-sm); cursor: pointer; transition: background .15s, color .15s;
}
.zoom-reset:hover:not(:disabled) { background: rgba(255,255,255,.18); color: #fff; }
.zoom-reset:disabled { cursor: not-allowed; }
.canvas-wrapper {
  position: relative; background: #fff; box-shadow: 0 0 40px rgba(0,0,0,.5);
  width: 100%; height: auto; display: block; user-select: none;
  margin: 0 auto; border-radius: 2px;
}
.design-img { display: block; width: 100%; height: auto; pointer-events: none; }
.pdf-frame  { width: 100%; height: 10000px; border: none; display: block; pointer-events: none; }
.overlay    { position: absolute; top: 0; left: 0; width: 100%; height: 100%; cursor: crosshair; z-index: 10; }

/* Pins */
.pin-rect {
  position: absolute; border: 2px solid #EF4444;
  background: rgba(239,68,68,.10); cursor: pointer; z-index: 20;
  pointer-events: auto; transition: background .15s;
}
.pin-rect:hover { background: rgba(239,68,68,.25); z-index: 30; }
.pin-rect.active-pin {
  border-color: #F59E0B; background: rgba(245,158,11,.2);
  z-index: 35; box-shadow: 0 0 0 3px rgba(37,99,235,.5);
}
.pin-badge {
  position: absolute; top: -11px; left: -11px;
  width: 22px; height: 22px; background: #EF4444; color: #fff;
  border-radius: 50%; text-align: center; line-height: 22px;
  font-size: 11px; font-weight: 700; box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
#selectionBox {
  border: 2px dashed #EF4444; background: rgba(239,68,68,.15);
  position: absolute; display: none; pointer-events: none; z-index: 100;
}

/* ============================================
   Detail — Right Sidebar
   ============================================ */
.sidebar-right {
  width: var(--sidebar-r); background: var(--c-white);
  border-left: 1px solid var(--c-border);
  display: flex; flex-direction: column; flex-shrink: 0; z-index: 90;
}
.sidebar-header {
  padding: 14px 16px; background: var(--c-white);
  border-bottom: 1px solid var(--c-border); flex-shrink: 0;
}
.sidebar-header-title { font-size: 13px; font-weight: 700; color: var(--c-text); margin-bottom: 10px; }

.tab-group {
  display: flex; background: var(--c-bg); border-radius: var(--r-md);
  padding: 3px; gap: 2px;
}
.tab-btn {
  flex: 1; padding: 6px 8px; background: transparent; border: none;
  border-radius: var(--r-sm); cursor: pointer; font-size: 12px; font-weight: 500;
  color: var(--c-text-sub); transition: all .15s;
}
.tab-btn:hover { background: rgba(0,0,0,.04); color: var(--c-text); }
.tab-btn.active      { background: var(--c-white); color: var(--c-primary); font-weight: 700; box-shadow: var(--sh-sm); }
.tab-btn.active-done { background: var(--c-white); color: var(--c-text-sub); font-weight: 700; box-shadow: var(--sh-sm); }

.thread-list { flex: 1; overflow-y: auto; padding: 12px; background: var(--c-bg); }
.thread-card {
  background: var(--c-white); border: 1px solid var(--c-border); border-radius: var(--r-lg);
  margin-bottom: 10px; box-shadow: var(--sh-sm); cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
}
.thread-card.hidden { display: none; }
.thread-card:hover  { border-color: #D1D5DB; box-shadow: var(--sh-md); }
.thread-card.active { border-color: var(--c-primary); box-shadow: 0 0 0 2px rgba(37,99,235,.18); }

.thread-top {
  padding: 10px 12px; border-bottom: 1px solid var(--c-border);
  display: flex; justify-content: space-between; align-items: center;
}
.thread-num {
  width: 22px; height: 22px; background: #EF4444; color: #fff;
  border-radius: 50%; text-align: center; line-height: 22px;
  font-size: 11px; font-weight: 700; margin-right: 8px; flex-shrink: 0; display: inline-block;
}
.thread-delete-btn {
  background: none; border: none; cursor: pointer; color: var(--c-text-muted);
  padding: 3px 5px; border-radius: var(--r-sm); font-size: 14px;
  transition: background .15s, color .15s; line-height: 1;
}
.thread-delete-btn:hover { background: #FEF2F2; color: var(--c-danger); }

/* ケバブメニュー */
.kebab-wrap { position: relative; display: inline-block; }
.kebab-btn {
  background: none; border: none; cursor: pointer; padding: 2px 5px;
  border-radius: var(--r-sm); color: var(--c-text-muted);
  display: flex; flex-direction: column; gap: 3px; align-items: center;
  transition: background .15s; line-height: 1;
}
.kebab-btn:hover { background: var(--c-bg); }
.kebab-dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; display: block; }
.kebab-menu {
  display: none; position: absolute; top: calc(100% + 4px); left: 0;
  background: var(--c-white); border: 1px solid var(--c-border);
  border-radius: var(--r-md); box-shadow: var(--sh-md);
  z-index: 300; min-width: 148px; overflow: hidden;
}
.kebab-menu.open { display: block; }
.kebab-menu-item {
  width: 100%; text-align: left; background: none; border: none; cursor: pointer;
  padding: 9px 14px; font-size: 13px; color: var(--c-danger); display: block;
  transition: background .12s;
}
.kebab-menu-item:hover { background: #FEF2F2; }

.thread-status select {
  padding: 3px 6px; font-size: 11px; font-weight: 700;
  border-radius: var(--r-sm); border: 1px solid var(--c-border); width: auto;
}

.comment-block { padding: 12px; border-bottom: 1px solid #F3F4F6; cursor: default; }
.comment-meta  { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.comment-author { font-size: 12px; font-weight: 700; color: var(--c-text); }
.comment-date   { font-size: 11px; color: var(--c-text-muted); }
.comment-body   { font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; }
.comment-actions { display: flex; justify-content: flex-end; gap: 4px; margin-top: 6px; }
.comment-actions button {
  font-size: 11px; color: var(--c-text-muted); background: none; border: none;
  cursor: pointer; padding: 2px 7px; border-radius: var(--r-sm); transition: background .15s, color .15s;
}
.comment-actions button:hover { background: var(--c-bg); color: var(--c-text); }

.attachment-link {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 6px;
  font-size: 11px; background: var(--c-bg); padding: 4px 8px;
  border-radius: var(--r-sm); color: var(--c-text-sub);
  text-decoration: none; border: 1px solid var(--c-border); transition: background .15s;
}
.attachment-link:hover { background: #E5E7EB; }

.reply-area {
  padding: 10px 12px; background: #FAFAFA;
  border-top: 1px solid var(--c-border); cursor: default;
}
.reply-area textarea {
  border: 1px solid var(--c-border); border-radius: var(--r-md);
  padding: 8px 10px; font-size: 12px; height: 52px; resize: vertical; line-height: 1.5;
}
.reply-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.file-input-wrapper input[type="file"] {
  font-size: 11px; padding: 2px; border: none; background: none; width: auto; color: var(--c-text-muted);
}

/* ============================================
   Modal
   ============================================ */
.modal {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 1000; justify-content: center; align-items: center;
}
.modal[style*="flex"] .modal-content { animation: modalIn .2s ease; }
@keyframes modalIn { from { opacity:0; transform: scale(.96) translateY(8px); } to { opacity:1; transform: none; } }
.modal-content {
  background: var(--c-white); padding: 28px; width: 460px; max-width: 94vw;
  border-radius: var(--r-xl); box-shadow: var(--sh-lg);
}
.modal-title  { font-size: 16px; font-weight: 700; margin: 0 0 16px; }
.modal-desc   { font-size: 13px; color: var(--c-text-sub); margin: 0 0 20px; line-height: 1.6; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.modal-field  { margin-bottom: 16px; }

/* ============================================
   Tables (dashboard, admin)
   ============================================ */
table { width: 100%; border-collapse: collapse; }
th { padding: 10px 14px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--c-text-muted); background: var(--c-bg); border-bottom: 1px solid var(--c-border); text-align: left; }
td { padding: 12px 14px; border-bottom: 1px solid var(--c-border); font-size: 13px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #FAFAFA; }

/* ============================================
   Project Edit
   ============================================ */
.edit-scroll  { flex: 1; overflow-y: auto; background: var(--c-bg); }
.edit-content { padding: 28px 32px; max-width: 860px; margin: 0 auto; }
.edit-panel   { background: var(--c-white); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: 24px; margin-bottom: 20px; }
.edit-panel-title { font-size: 14px; font-weight: 700; margin: 0 0 20px; padding-bottom: 14px; border-bottom: 1px solid var(--c-border); }
.form-field   { margin-bottom: 16px; }
.form-row     { display: flex; gap: 12px; }
.form-hint    { font-size: 11px; color: var(--c-text-muted); margin-top: 4px; }

.upload-zone {
  border: 2px dashed var(--c-border); border-radius: var(--r-lg); padding: 20px 16px;
  text-align: center; transition: border-color .2s, background .2s; cursor: pointer;
  background: var(--c-bg);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--c-primary); background: #EFF6FF;
}
.upload-zone.drag-over { border-style: solid; }

/* Screenshot loading */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 15px; height: 15px; border: 2px solid var(--c-border);
  border-top-color: var(--c-primary); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block; flex-shrink: 0;
}

/* ============================================
   Profile / Settings
   ============================================ */
.settings-scroll { flex: 1; overflow-y: auto; background: var(--c-bg); }
.settings-wrap   { padding: 32px; max-width: 560px; }
.settings-card   { background: var(--c-white); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: 24px; margin-bottom: 20px; }
.settings-card-title { font-size: 14px; font-weight: 700; margin: 0 0 20px; padding-bottom: 12px; border-bottom: 1px solid var(--c-border); }
.settings-field  { margin-bottom: 16px; }
