:root {
  --bg: #FAFAF8;
  --text: #1C1C1C;
  --muted: #8A8A8A;
  --accent: #B5A694;
  --border: #E5E3DF;
  --white: #FFFFFF;
  --font-sans: "Futura", "Century Gothic", "Noto Sans JP", "Trebuchet MS", system-ui, -apple-system, sans-serif;
  --font-display: "Wooddale", "ヒラギノ角ゴ Pro W6", "Hiragino Kaku Gothic Pro", sans-serif;
}
@font-face {
  font-family: "Wooddale";
  src: url("/fonts/Wooddale-Condensed.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-sans); background: var(--bg); color: var(--text); line-height: 1.5; min-height: 100vh; }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; }
.login-container { padding: 0; width: 100%; max-width: 380px; margin: 0 24px; }
.login-logo { text-align: center; margin-bottom: 40px; }
.login-logo img { height: 56px; width: auto; margin-bottom: 20px; display: block; margin-left: auto; margin-right: auto; }
.login-logo p { color: var(--muted); font-size: 9px; letter-spacing: 0.25em; text-transform: uppercase; margin-bottom: 0; }

/* Login refinements */
.login-divider { border: none; border-top: 1px solid var(--border); margin: 32px 0; }
.login-form .form-group input { border: none; border-bottom: 1px solid var(--border); border-radius: 0; padding: 10px 0; background: transparent; }
.login-form .form-group input:focus { border-color: var(--text); }
.login-form .btn { width: 100%; margin-top: 16px; letter-spacing: 0.18em; padding: 14px 22px; }
.login-footer { margin-top: 28px; display: flex; justify-content: space-between; gap: 12px; }
.login-footer a { font-size: 10px; color: var(--muted); text-decoration: none; letter-spacing: 0.04em; }
.login-footer a:hover { color: var(--text); }

/* Header */
.portal-header { background: var(--white); border-bottom: 1px solid var(--border); padding: 0 32px; height: 60px; display: flex; align-items: center; justify-content: space-between; position: sticky;
top: 0; z-index: 100; }
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo img { height: 32px; width: auto; flex-shrink: 0; }
.logo span { color: var(--muted); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.portal-client-name { color: var(--muted); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; font-family: system-ui, sans-serif; flex-shrink: 0; }

/* Layout */
.portal-body { display: grid; grid-template-columns: 260px 1fr; min-height: calc(100vh - 60px); }
.portal-sidebar { background: var(--white); border-right: 1px solid var(--border); padding: 0; }
.portal-main { padding: 32px; min-width: 0; }

/* Sidebar label */
.sidebar-label { font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); padding: 20px 20px 10px; border-top: 1px solid var(--border); }
.sidebar-label:first-child { border-top: none; padding-top: 24px; }

/* Project cards — editorial rows, no rounded corners */
.card { background: transparent; border: none; border-top: 1px solid var(--border); padding: 14px 20px; margin-bottom: 0; cursor: pointer; transition: background 0.15s; position: relative; }
.card:hover { background: rgba(181,166,148,0.08); }
.card.active { background: rgba(181,166,148,0.1); }
.card.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--text); }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.card-header h3 { font-size: 13px; font-weight: 500; line-height: 1.3; padding-right: 8px; }
.card-desc { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.card-date { color: var(--muted); font-size: 11px; }

/* Sidebar nav */
.sidebar-nav a { display: block; padding: 9px 20px; color: var(--muted); text-decoration: none; font-size: 13px; transition: color 0.15s; }
.sidebar-nav a:hover { color: var(--text); }
.sidebar-nav a.active { color: var(--text); font-weight: 500; }
.nav-section-label { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding: 16px 20px 6px; margin: 0; }

/* Badges */
.badge { display: inline-block; padding: 2px 7px; font-size: 10px; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; }
.badge-green { background: #E6EFE8; color: #3A6145; }
.badge-blue { background: #E4EAF2; color: #3A4F72; }
.badge-yellow { background: #F5EDDB; color: #7A5520; }
.badge-red { background: #F2E8E8; color: #8B3838; }
.badge-grey { background: #EEECE8; color: #5A5754; }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 6px; letter-spacing: 0.06em; text-transform: uppercase; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px 14px; border: 1px solid var(--border); font-size: 14px; color: var(--text); background: var(--white);
font-family: inherit; transition: border-color 0.2s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--text); }

/* Buttons — sharp, black primary */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 22px; font-size: 11px; font-weight: 500; cursor: pointer; border: none; transition: opacity 0.2s; font-family:
inherit; text-decoration: none; letter-spacing: 0.08em; text-transform: uppercase; }
.btn:hover { opacity: 0.75; }
.btn-primary { background: var(--text); color: var(--white); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-sm { padding: 6px 14px; font-size: 11px; width: auto !important; }
.btn-danger { background: #ef4444; color: white; }
.btn:active { opacity: 0.7; transform: scale(0.98); }

/* Tabs */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab-btn { padding: 10px 20px; border: none; background: none; color: var(--muted); cursor: pointer; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; border-bottom: 2px solid
transparent; margin-bottom: -1px; font-family: inherit; transition: color 0.2s; }
.tab-btn.active { color: var(--text); border-bottom-color: var(--text); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Invoices */              
.invoice-row { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; background: var(--white); border: 1px solid var(--border); margin-bottom: 8px; }
.invoice-info .amount { font-family: var(--font-sans); font-weight: 500; font-size: 20px; }
.invoice-info .due-date { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.invoice-actions { display: flex; align-items: center; gap: 10px; }

/* Design cards */
.design-card { background: var(--white); border: 1px solid var(--border); overflow: hidden; margin-bottom: 16px; }
.design-image { width: 100%; max-height: 300px; object-fit: cover; display: block; }
.design-info { padding: 16px; }
.design-info h4 { font-family: var(--font-sans); font-size: 15px; font-weight: 500; margin-bottom: 8px; }
.design-notes { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.design-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Messages */
.messages-container { min-height: 300px; max-height: 400px; overflow-y: auto; padding: 16px; background: var(--bg); border: 1px solid var(--border); border-bottom: none; display: flex; flex-direction:
column; gap: 12px; }
.message { max-width: 70%; padding: 12px 16px; }
.message-admin { background: var(--white); border: 1px solid var(--border); align-self: flex-start; }
.message-client { background: var(--text); color: var(--white); align-self: flex-end; }
.message-client .message-time { color: rgba(255,255,255,0.6); }
.message-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; gap: 16px; }
.message-header strong { font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; }
.message-time { font-size: 11px; color: var(--muted); }
.message-input-area { display: flex; border: 1px solid var(--border); overflow: hidden; }
.message-input-area textarea { flex: 1; border: none; padding: 12px 16px; font-family: inherit; font-size: 14px; resize: none; height: 50px; background: var(--white); }
.message-input-area textarea:focus { outline: none; }
.message-input-area button { background: var(--text); color: white; border: none; padding: 0 20px; cursor: pointer; font-family: inherit; font-size: 11px; letter-spacing: 0.08em; text-transform:
uppercase; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; background: var(--white); border: 1px solid var(--border); }
.data-table th { text-align: left; padding: 12px 16px; font-size: 10px; font-weight: 500; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; border-bottom: 1px solid var(--border);
background: var(--bg); }
.data-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(181,166,148,0.04); }
.status-select { border: 1px solid var(--border); padding: 4px 8px; font-size: 13px; font-family: inherit; background: var(--white); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: var(--white); border: 1px solid var(--border); padding: 32px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; margin: 16px; }
.modal h2 { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.03em; font-size: 20px; font-weight: normal; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* Utils */
.hidden { display: none !important; }
.empty-state { color: var(--muted); font-size: 13px; text-align: center; padding: 40px; }
.error-msg { color: #ef4444; font-size: 14px; margin-top: 12px; }
.section-title { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.03em; font-size: 22px; font-weight: normal; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mb-6 { margin-bottom: 24px; }

/* Sidebar nav override (inline styles in HTML) */
.quick-nav-link { display: block !important; padding: 9px 20px !important; border-radius: 0 !important; color: var(--muted) !important; font-size: 13px !important; font-weight: normal !important;
text-decoration: none !important; transition: color 0.15s !important; }
.quick-nav-link:hover { color: var(--text) !important; background: rgba(181,166,148,0.06) !important; }
.quick-nav-link.active { color: var(--text) !important; font-weight: 500 !important; }

/* Service cards in modal */
.service-card { border: 1px solid var(--border) !important; border-radius: 0 !important; transition: border-color 0.2s !important; }
.service-card:hover { border-color: var(--text) !important; }

.mobile-menu-btn { display: none; background: none; border: none; cursor: pointer; font-size: 24px; padding: 4px 10px; color: var(--text); line-height: 1; margin-right: 4px; }

@media (max-width: 768px) {
  .mobile-menu-btn { display: flex; align-items: center; }
  .portal-body { grid-template-columns: 1fr; }
  .portal-sidebar { display: none; position: fixed; top: 60px; left: 0; right: 0; bottom: 0; z-index: 200; background: var(--white); overflow-y: auto; padding: 0; border-right: none; border-top: 1px
solid var(--border); }
  .portal-sidebar.mobile-open { display: block; }
  .portal-main { padding: 16px; }
  #admin-name { display: none; }
  .portal-header { padding: 0 16px; }
  .catalogue-grid { grid-template-columns: 1fr 1fr; }

  /* Invoice/quote rows — stack on mobile */
  .invoice-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .invoice-actions { width: 100%; flex-wrap: wrap; }

  /* Tab bar — scroll horizontally */
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab-btn { white-space: nowrap; }

  /* Data tables — horizontal scroll via parent */
  .data-table { min-width: 560px; }
  .portal-main > section, .portal-main > div { overflow-x: auto; }

  /* Flex-between rows — allow wrapping */
  .flex-between { flex-wrap: wrap; gap: 10px; }

  /* Modals */
  .modal { padding: 20px; margin: 12px; max-width: calc(100vw - 24px); }
  .modal-actions { flex-wrap: wrap; }

  /* Messages */
  .messages-container { max-height: 260px; }

  /* Login */
  .login-container { padding: 32px 20px; }

  /* Design actions */
  .design-actions { justify-content: flex-start; }
}

/* Catalogue */
.catalogue-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.catalogue-item { position: relative; overflow: hidden; aspect-ratio: 1; }
.catalogue-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity 0.2s; }
.catalogue-item:hover img { opacity: 0.88; }
.save-btn { position: absolute; bottom: 8px; right: 8px; width: 34px; height: 34px; border: none; background: rgba(255,255,255,0.92); font-size: 18px; cursor: pointer; display: flex; align-items:
center; justify-content: center; transition: transform 0.1s; line-height: 1; padding: 0; }
.save-btn.saved { color: var(--accent); }
.save-btn:hover { transform: scale(1.12); }
.admin-cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.admin-cat-item { position: relative; overflow: hidden; border: 1px solid var(--border); }
.admin-cat-item img { width: 100%; height: 200px; object-fit: cover; display: block; }
.admin-cat-item .cat-badge { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,0.52); color: #fff; font-size: 11px; padding: 2px 7px; }
.admin-cat-item .cat-delete { position: absolute; top: 6px; right: 6px; background: rgba(255,255,255,0.9); border: none; width: 26px; height: 26px; cursor: pointer; font-size: 16px; display: flex;
align-items: center; justify-content: center; line-height: 1; padding: 0; }

#pd-messages-list { min-height: 200px; max-height: 400px; overflow-y: auto; padding: 16px; background: var(--bg); border: 1px solid var(--border); margin-bottom: 12px; display: flex; flex-direction:
column; gap: 8px; }
#progress-tracker { display: flex; align-items: flex-start; margin-bottom: 24px; padding: 14px 20px; background: var(--bg); border: 1px solid var(--border); overflow-x: auto; max-width: 480px; }

/* ── SIDEBAR NAV REBUILD ── */
.sidebar-nav a { display:flex !important; align-items:center; }
.sidebar-badge { display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 5px;background:var(--accent);color:white;font-size:10px;font-weight:600;margin-left:auto; }
.status-dot { display:inline-block;font-size:10px;font-weight:500;letter-spacing:0.04em;text-transform:uppercase;padding:2px 8px; }
.status-dot.quote-ready  { background:#FFF3CD;color:#92681A; }
.status-dot.action-needed { background:#FDE8EC;color:#9B2335; }
.status-dot.in-progress  { background:#F0F0EE;color:#666; }
.status-dot.complete     { background:#E8F5E9;color:#2E7D32; }
.action-banner { background:#FFFBF0;border:1px solid #F0E0B0;padding:12px 20px;margin-bottom:24px; }
.action-banner-item { display:flex;align-items:center;justify-content:space-between;font-size:13px;padding:4px 0; }
.action-banner-item+.action-banner-item { border-top:1px solid #F0E0B0;margin-top:8px;padding-top:12px; }
.action-banner-item a { color:var(--text);font-weight:500;text-decoration:none;font-size:12px;letter-spacing:0.05em; }
.section-title { font-size:20px;font-weight:400;font-family:var(--font-display);text-transform:uppercase;letter-spacing:0.03em;margin-bottom:24px;padding-bottom:16px;border-bottom:1px solid var(--border); }
.portal-section { padding:0; }
.progress-bar { display:flex;align-items:flex-start;width:100%;margin:12px 0 24px; }
.progress-step { flex:1;display:flex;flex-direction:column;align-items:flex-start;position:relative;padding-bottom:4px; }
.progress-step:not(:last-child)::after { content:'';position:absolute;top:5px;left:12px;right:-50%;height:1px;background:var(--border);z-index:0; }
.progress-step.done:not(:last-child)::after { background:var(--accent); }
.progress-dot { width:12px;height:12px;border-radius:50%;border:2px solid var(--border);background:var(--white);z-index:1;margin-bottom:6px;flex-shrink:0; }
.progress-step.done .progress-dot { background:var(--accent);border-color:var(--accent); }
.progress-step.current .progress-dot { background:var(--text);border-color:var(--text); }
.progress-label { font-size:10px;color:var(--muted);letter-spacing:0.04em;text-transform:uppercase;line-height:1.3; }
.progress-step.current .progress-label { color:var(--text);font-weight:500; }
.messages-xp-layout { display:grid;grid-template-columns:260px 1fr;height:calc(100vh - 180px);min-height:400px;border:1px solid var(--border);background:var(--white);overflow:hidden; }
.messages-xp-sidebar { border-right:1px solid var(--border);overflow-y:auto; }
.messages-xp-content { display:flex;flex-direction:column;overflow:hidden; }
.message-thread-header { padding:16px 20px;border-bottom:1px solid var(--border);font-size:14px;font-weight:500; }
.message-thread-body { flex:1;overflow-y:auto;padding:16px 20px; }
.message { margin-bottom:12px;display:flex;flex-direction:column; }
.message-from-admin { align-items:flex-start; }
.message-from-client { align-items:flex-end; }
.message-bubble { max-width:70%;padding:10px 14px;font-size:14px;line-height:1.4; }
.message-from-admin .message-bubble { background:var(--bg);border:1px solid var(--border); }
.message-from-client .message-bubble { background:var(--text);color:white; }
.message-time { font-size:10px;color:var(--muted);margin-top:4px;padding:0 4px; }
.message-input-area-xp { border-top:1px solid var(--border);padding:12px;display:flex;flex-shrink:0; }
.message-input-area-xp textarea { flex:1;border:none;padding:10px;font-family:inherit;font-size:14px;resize:none;height:44px;background:transparent;outline:none; }
.message-input-area-xp button { background:var(--text);color:white;border:none;padding:0 20px;cursor:pointer;font-family:inherit;font-size:11px;letter-spacing:0.08em;text-transform:uppercase; }
.empty-state { color:var(--muted);font-size:14px;padding:40px 0;text-align:center; }
.badge-amber { background:#FFF3CD;color:#92681A; }
.badge-green { background:#E8F5E9;color:#2E7D32; }
.badge-muted { background:#F0F0EE;color:#666; }
@media(max-width:768px){
  .messages-xp-layout { grid-template-columns:1fr;height:auto; }
  .messages-xp-sidebar { border-right:none;border-bottom:1px solid var(--border);max-height:200px; }
  .artist-grid { grid-template-columns:1fr !important; }
}
