:root{
  --bg:#0e0e10;
  --panel:#16161a;
  --accent:#e11d48;   /* blood red */
  --accent-2:#22d3ee; /* cyan */
  --accent-3:#f59e0b; /* amber */
  --text:#f5f5f5;
  --muted:#a1a1aa;
  --pin:#dc2626;
  --node:#1f1f25;
  --node-border:#2a2a33;
  --green:#22c55e;
  --purple:#a855f7;
}
html,body{height:100%;margin:0;background:var(--bg);color:var(--text);font-family:Inter,system-ui,Segoe UI,Roboto,Helvetica,Arial,sans-serif;}
.app{
  display:grid;
  grid-template-columns: 320px 1fr;
  grid-template-rows: 64px 1fr;
  grid-template-areas: "topbar topbar" "sidebar board";
  height:100%;
}
.topbar{
  grid-area:topbar;
  display:flex;align-items:center;gap:12px;
  padding:8px 12px;border-bottom:1px solid #222;background:linear-gradient(180deg,#111,#0f0f12 40%,#0e0e10);
  position:sticky;top:0;z-index:5;
}
.logo{font-weight:900;letter-spacing:.5px}
.logo i{color:var(--accent)}
.mode-select,.toolbar button,.toolbar .seg{
  background:var(--panel);border:1px solid #26262c;color:var(--text);
  border-radius:10px;padding:8px 10px;font-size:14px;
}
.toolbar{display:flex;gap:8px;align-items:center;margin-left:auto}
.toolbar button{cursor:pointer;transition:transform .08s ease}
.toolbar button:hover{transform:translateY(-1px)}
.toolbar .seg{display:flex;gap:6px;padding:4px}
.toolbar .seg button{border-radius:8px;padding:6px 10px;border:none;background:#1a1a20}
.toolbar .seg button.active{background:var(--accent);color:white}
.toolbar-separator{width:1px;height:24px;background:#3a3a42;margin:0 8px;align-self:center}
.sidebar{
  grid-area:sidebar;border-right:1px solid #222;background:radial-gradient(200% 120% at 0% 0%, #151515 0%, #101012 62%, #0e0e10 100%);
  overflow:auto;scrollbar-width:thin;padding:14px 12px 18px;position:relative;
}
.section{margin-bottom:14px;padding:12px;border:1px solid #222;border-radius:12px;background:var(--panel);transition:border-color 0.3s ease}
.section h3{margin:0 0 8px 0;font-size:14px;color:#ddd}
label{display:block;font-size:12px;color:var(--muted);margin:8px 0 4px}
input[type="text"],input[type="datetime-local"],textarea,select{
  width:100%;background:#121216;color:#eaeaea;border:1px solid #2a2a33;border-radius:8px;padding:8px;font-size:14px;box-sizing:border-box
}
textarea{min-height:70px;resize:vertical}
.btn{
  background:#1b1b21;color:#f3f3f3;border:1px solid #2a2a33;border-radius:10px;padding:8px 10px;font-size:14px;cursor:pointer;white-space:nowrap
}
.btn.primary{background:var(--accent);border-color:#8a0f26}
.btn.ghost{background:transparent;color:#ddd}
.btn-row{display:flex;gap:8px;flex-wrap:wrap}
.tag-row{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.tag{
  font-size:11px;padding:5px 8px;border-radius:999px;border:1px solid #3a3a42;background:#141418;color:#ddd;cursor:pointer;user-select:none;
  display:inline-flex;align-items:center;gap:4px;
}
.tag.active{background:var(--accent);border-color:#8a0f26}
.board{grid-area:board;position:relative;overflow:hidden}
.cork{
  position:absolute;inset:0;
  background:
    radial-gradient(1px 1px at 25px 25px, #2a2a2a 1px, transparent 0) 0 0/40px 40px,
    radial-gradient(1px 1px at 5px 15px, #252525 1px, transparent 0) 0 0/30px 30px,
    #0f0f12;
  filter:contrast(1.02) saturate(0.85) brightness(0.9);
  transition: background 0.5s ease, filter 0.5s ease;
}
.cork.sphere-mode{
  background: radial-gradient(ellipse at center, #0a1628 0%, #050a14 50%, #020408 100%);
  filter: none;
}
.hint{
  position:absolute;left:12px;bottom:12px;background:#0f0f14c0;border:1px solid #222;border-radius:10px;padding:10px 12px;font-size:12px;color:#cfcfd6;z-index:6;backdrop-filter: blur(6px)
}
.hint kbd{border:1px solid #555;border-bottom-color:#333;border-radius:6px;padding:1px 6px;font-size:11px}
.close-board-btn{
  position:absolute;
  top:12px;
  right:12px;
  width:32px;
  height:32px;
  border-radius:50%;
  border:2px solid #6b7280;
  background:transparent;
  cursor:pointer;
  z-index:100;
  display:flex;
  align-items:center;
  justify-content:center;
  transition:all 0.2s;
}
.close-board-btn svg{width:20px;height:20px;color:#6b7280}
.close-board-btn:hover{border-color:#9ca3af}
.close-board-btn:hover svg{color:#9ca3af}
.toast{
  position:fixed;
  top:60px;
  left:50%;
  transform:translateX(-50%);
  background:#1a1a2eee;
  border:1px solid #3b82f6;
  color:#f5f5f5;
  padding:12px 24px;
  border-radius:8px;
  font-size:14px;
  font-weight:500;
  backdrop-filter:blur(8px);
  box-shadow:0 4px 20px rgba(0,0,0,0.4);
  z-index:9999;
  display:none;
  animation:toastSlide 0.3s ease-out;
  max-width:90vw;
  text-align:center
}
@keyframes toastSlide{
  from{opacity:0;transform:translateX(-50%) translateY(-10px)}
  to{opacity:1;transform:translateX(-50%) translateY(0)}
}
/* View-only banner for shared boards */
.view-only-banner{
  position:fixed;
  top:0;
  left:50%;
  transform:translateX(-50%);
  background:rgba(255, 193, 7, 0.95);
  color:#333;
  padding:8px 20px;
  border-radius:0 0 8px 8px;
  font-size:14px;
  font-weight:500;
  z-index:10000;
  box-shadow:0 2px 8px rgba(0,0,0,0.3);
  display:none
}
.view-only-banner a{
  color:#333;
  text-decoration:underline
}
.legend{display:flex;gap:8px;flex-wrap:wrap}
.chip{display:inline-flex;align-items:center;gap:6px;background:#13131a;border:1px solid #2a2a33;border-radius:999px;padding:5px 8px;font-size:12px;transition:all 0.2s}
.chip.active{background:#7dd3fc22;border-color:#7dd3fc;box-shadow:0 0 8px #7dd3fc44}
.dot{width:10px;height:10px;border-radius:50%}
/* Konva container should fill board */
#stage{position:absolute;inset:0}
/* Link options popup */
.link-popup{
  position:fixed;
  background:#16161acc;
  border:1px solid #2a2a33;
  border-radius:12px;
  padding:14px;
  backdrop-filter:blur(10px);
  z-index:100;
  display:none;
  box-shadow:0 8px 24px rgba(0,0,0,0.4);
  min-width:220px;
}
.link-popup h4{margin:0 0 10px 0;font-size:13px;color:#f5f5f5}
.link-popup .tag-row{margin-bottom:10px}
.link-popup .btn{margin-top:4px;width:100%}
.link-popup .tag{
  display:flex;
  align-items:center;
  gap:6px;
  transition:all 0.15s ease;
}
.link-popup .tag:hover{
  transform:translateY(-1px);
  border-color:#666;
}
.link-popup .tag.active{
  transform:scale(1.05);
  box-shadow:0 2px 8px rgba(0,0,0,0.3);
}
/* Template editor modal */
.modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.8);
  backdrop-filter:blur(4px);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:200;
}
.modal.active{display:flex}
.modal-content{
  background:var(--panel);
  border:1px solid #2a2a33;
  border-radius:12px;
  padding:20px;
  max-width:600px;
  max-height:80vh;
  overflow-y:auto;
  box-shadow:0 20px 60px rgba(0,0,0,0.5);
}
.modal h2{margin:0 0 16px 0;font-size:16px;color:#f5f5f5}
/* Board picker styles */
.board-picker-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:16px;
}
.board-picker-header h2{margin:0;font-size:18px;color:#f5f5f5}
.board-picker-close{
  width:32px;
  height:32px;
  border:none;
  background:transparent;
  color:#9ca3af;
  font-size:24px;
  cursor:pointer;
  border-radius:6px;
  display:flex;
  align-items:center;
  justify-content:center;
  transition:all 0.15s ease;
}
.board-picker-close:hover{
  background:#2a2a33;
  color:#f5f5f5;
}
.board-picker-list{
  display:flex;
  flex-direction:column;
  gap:10px;
  max-height:400px;
  overflow-y:auto;
  padding-right:4px;
}
.board-picker-list::-webkit-scrollbar{width:6px}
.board-picker-list::-webkit-scrollbar-track{background:transparent}
.board-picker-list::-webkit-scrollbar-thumb{background:#3a3a44;border-radius:3px}
.board-picker-item{
  display:flex;
  align-items:flex-start;
  gap:14px;
  padding:14px 16px;
  background:#1a1a22;
  border:1px solid #2a2a33;
  border-radius:10px;
  cursor:pointer;
  transition:all 0.15s ease;
}
.board-picker-item:hover{
  background:#22222c;
  border-color:#4a4a54;
  transform:translateY(-2px);
  box-shadow:0 4px 12px rgba(0,0,0,0.3);
}
.board-picker-icon{
  width:40px;
  height:40px;
  border-radius:8px;
  background:#2a2a33;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:18px;
  flex-shrink:0;
}
.board-picker-icon.classic{background:linear-gradient(135deg,#3b3b4a,#2a2a33)}
.board-picker-icon.sphere{background:linear-gradient(135deg,#3a4a5a,#2a3a4a)}
.board-picker-content{flex:1;min-width:0}
.board-picker-title-row{
  display:flex;
  align-items:center;
  gap:8px;
  margin-bottom:6px;
}
.board-picker-name{
  font-size:15px;
  font-weight:600;
  color:#f5f5f5;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.board-picker-badge{
  font-size:10px;
  padding:2px 6px;
  border-radius:4px;
  background:#4a3a5a;
  color:#c4a6e6;
  text-transform:uppercase;
  letter-spacing:0.5px;
  flex-shrink:0;
}
.board-picker-meta{
  font-size:12px;
  color:#7a7a8a;
  display:flex;
  gap:12px;
}
.board-picker-meta span{
  display:flex;
  align-items:center;
  gap:4px;
}
.board-picker-loading{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding:40px 20px;
  color:#7a7a8a;
  gap:12px;
}
.board-picker-loading .spinner{
  width:24px;
  height:24px;
  border:2px solid #3a3a44;
  border-top-color:#ff3b3b;
  border-radius:50%;
  animation:spin 0.8s linear infinite;
}
@keyframes spin{to{transform:rotate(360deg)}}
.board-picker-empty{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding:40px 20px;
  text-align:center;
}
.board-picker-empty .empty-icon{
  font-size:48px;
  margin-bottom:12px;
  opacity:0.5;
}
.board-picker-empty p{
  margin:0 0 4px 0;
  font-size:15px;
  color:#f5f5f5;
}
.board-picker-empty span{
  font-size:13px;
  color:#7a7a8a;
}

/* Board Action Buttons */
.board-picker-item{cursor:default}
.board-picker-item-main{
  display:flex;
  align-items:flex-start;
  gap:14px;
  flex:1;
  min-width:0;
}
.board-picker-actions{
  display:flex;
  gap:8px;
  margin-top:10px;
  padding-top:10px;
  border-top:1px solid #2a2a33;
}
.board-action-btn{
  padding:6px 10px;
  border-radius:6px;
  border:1px solid #3a3a44;
  background:transparent;
  color:#9ca3af;
  cursor:pointer;
  transition:all 0.15s ease;
  display:flex;
  align-items:center;
  gap:5px;
  font-size:12px;
  font-family:inherit;
}
.board-action-btn:hover{
  background:rgba(255,255,255,0.08);
  color:#e5e5e5;
  border-color:#4a4a54;
}
.board-action-btn svg{
  width:14px;
  height:14px;
}
.board-action-btn.danger:hover{
  background:rgba(239,68,68,0.15);
  color:#ef4444;
  border-color:#ef4444;
}
.board-action-btn.primary{
  background:var(--accent);
  border-color:var(--accent);
  color:white;
  font-weight:500;
}
.board-action-btn.primary:hover{
  background:#e62e2e;
  border-color:#e62e2e;
}
.board-picker-rename-input{
  flex:1;
  padding:8px 12px;
  border:1px solid var(--accent);
  border-radius:6px;
  background:#1a1a22;
  color:#f5f5f5;
  font-size:14px;
  font-family:inherit;
  outline:none;
}
.board-picker-rename-input:focus{
  box-shadow:0 0 0 2px rgba(255,59,59,0.2);
}
.board-picker-rename-actions{
  display:flex;
  gap:6px;
}
.board-picker-current{
  position:relative;
}
.board-picker-current::after{
  content:'Current';
  position:absolute;
  top:8px;
  right:8px;
  font-size:10px;
  padding:2px 8px;
  border-radius:4px;
  background:var(--accent);
  color:white;
  text-transform:uppercase;
  letter-spacing:0.5px;
}

/* Template Picker Modal */
.template-picker-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:8px;
}
.template-picker-header h2{
  margin:0;
  font-size:18px;
  color:#f5f5f5;
}
.template-picker-subtitle{
  color:#9ca3af;
  font-size:13px;
  margin:0 0 16px 0;
}
.template-picker-list{
  display:flex;
  flex-direction:column;
  gap:8px;
  max-height:400px;
  overflow-y:auto;
  margin-bottom:16px;
}
.template-option{
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px;
  background:#1a1a20;
  border:2px solid #2a2a33;
  border-radius:10px;
  cursor:pointer;
  transition:all 0.15s ease;
}
.template-option:hover{
  background:#22222a;
  border-color:#3a3a44;
}
.template-option.selected{
  border-color:var(--accent);
  background:#1a1a25;
}
.template-option.default{
  border-color:#3a3a44;
}
.template-option-icon{
  width:48px;
  height:48px;
  border-radius:10px;
  background:linear-gradient(135deg,#3b3b4a,#2a2a33);
  display:flex;
  align-items:center;
  justify-content:center;
  color:#a1a1aa;
  flex-shrink:0;
}
.template-option-info{
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:4px;
}
.template-option-name{
  font-size:14px;
  font-weight:500;
  color:#f5f5f5;
  display:flex;
  align-items:center;
  gap:8px;
}
.template-option-desc{
  font-size:12px;
  color:#9ca3af;
}
.template-badge{
  font-size:10px;
  padding:2px 6px;
  border-radius:4px;
  background:var(--accent);
  color:white;
  text-transform:uppercase;
  letter-spacing:0.5px;
}
.template-badge.user{
  background:#22c55e;
}
.template-section-divider{
  display:flex;
  align-items:center;
  gap:12px;
  margin:16px 0 8px;
  color:#64748b;
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:1px;
}
.template-section-divider::before,
.template-section-divider::after{
  content:'';
  flex:1;
  height:1px;
  background:#2a2a33;
}
.template-picker-footer{
  display:flex;
  justify-content:flex-end;
  gap:8px;
  padding-top:8px;
  border-top:1px solid #2a2a33;
}
.template-option-actions{
  display:flex;
  gap:4px;
  opacity:0;
  transition:opacity 0.15s ease;
}
.template-option:hover .template-option-actions{
  opacity:1;
}
.template-option-action{
  width:28px;
  height:28px;
  border:none;
  background:rgba(255,255,255,0.1);
  border-radius:6px;
  color:#a1a1aa;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}
.template-option-action:hover{
  background:rgba(255,255,255,0.15);
  color:#fff;
}
.template-option-action.danger:hover{
  background:rgba(220,38,38,0.2);
  color:#ef4444;
}

.color-input{
  width:50px;
  height:32px;
  border:1px solid #2a2a33;
  border-radius:6px;
  cursor:pointer;
  background:transparent;
}
.item-list{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin-bottom:16px;
}
.item-row{
  display:flex;
  gap:8px;
  align-items:center;
  padding:8px;
  background:#1a1a20;
  border:1px solid #2a2a33;
  border-radius:8px;
  flex-wrap:wrap;
}
.item-row input[type="text"]{
  flex:1;
  min-width:120px;
  margin:0;
}
.item-row button{
  padding:6px 10px;
  background:#8b0000;
  color:#fff;
  border:none;
  border-radius:6px;
  cursor:pointer;
  font-size:12px;
}
.item-row button:hover{
  background:#a00000;
}
/* Toggle switch for link style (action/static) */
.toggle-switch{
  display:inline-flex;
  align-items:center;
  gap:8px;
  background:#0a0a0e;
  border:1px solid #2a2a33;
  border-radius:20px;
  padding:3px;
  cursor:pointer;
  user-select:none;
}
.toggle-option{
  padding:4px 12px;
  border-radius:16px;
  font-size:11px;
  color:#9ca3af;
  transition:all 0.2s ease;
  cursor:pointer;
}
.toggle-option.active{
  background:var(--accent) !important;
  color:#fff !important;
}
/* Three-dot menu button */
.menu-btn{
  background:transparent;
  border:1px solid #2a2a33;
  border-radius:6px;
  color:#9ca3af;
  font-size:16px;
  padding:4px 8px;
  cursor:pointer;
  line-height:1;
  transition:all 0.15s ease;
}
.menu-btn:hover{
  background:#1a1a20;
  border-color:#3a3a42;
  color:#ddd;
}
.menu-btn.hidden{
  visibility:hidden;
}
/* Static type popup */
.static-type-popup{
  position:fixed;
  background:#16161acc;
  border:1px solid #2a2a33;
  border-radius:12px;
  padding:14px;
  backdrop-filter:blur(10px);
  z-index:300;
  display:none;
  box-shadow:0 8px 24px rgba(0,0,0,0.4);
  min-width:180px;
}
.static-type-popup h4{
  margin:0 0 10px 0;
  font-size:12px;
  color:#f5f5f5;
}
.static-type-popup .toggle-switch{
  width:100%;
  justify-content:space-between;
}
/* Inline edit icon buttons */
.edit-icon-btn{
  background:rgba(34, 211, 238, 0.1);
  border:1px solid #22d3ee;
  border-radius:6px;
  color:#22d3ee;
  font-size:12px;
  padding:2px 6px;
  cursor:pointer;
  margin-left:6px;
  transition:all 0.15s ease;
  vertical-align:middle;
}
.edit-icon-btn:hover{
  background:#1a1a20;
  border-color:#7dd3fc;
  color:#7dd3fc;
}
/* Accordion styles for Input Value Editor */
.accordion-item{
  background:#0f0f14;
  border:1px solid #2a2a33;
  border-radius:10px;
  margin-bottom:10px;
  overflow:hidden;
}
.accordion-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:12px 14px;
  cursor:pointer;
  background:#1a1a20;
  transition:background 0.2s ease;
  user-select:none;
}
.accordion-header:hover{
  background:#22222a;
}
.accordion-header-left{
  display:flex;
  align-items:center;
  gap:8px;
  flex:1;
}
.accordion-link-label{
  font-weight:600;
  color:#7dd3fc;
  font-size:13px;
}
.accordion-target-name{
  color:#9ca3af;
  font-size:12px;
}
.accordion-arrow{
  color:#9ca3af;
  font-size:14px;
  transition:transform 0.3s ease;
}
.accordion-arrow.expanded{
  transform:rotate(90deg);
}
.accordion-content{
  max-height:0;
  overflow:hidden;
  transition:max-height 0.3s ease;
}
.accordion-content.expanded{
  max-height:500px;
}
.accordion-inner{
  padding:14px;
}
.value-pair-row{
  display:flex;
  gap:8px;
  align-items:center;
  margin-bottom:8px;
}
.value-pair-row input[type="text"]{
  flex:1;
  padding:8px;
  background:#1a1a20;
  border:1px solid #2a2a33;
  border-radius:6px;
  color:#f5f5f5;
  font-size:12px;
}
.value-pair-row input[type="text"]::placeholder{
  color:#6b7280;
}
.value-pair-row .key-input{
  flex:0 0 120px;
  font-weight:600;
}
.value-pair-row .value-input{
  flex:2;
}
.value-pair-row .delete-btn{
  padding:6px 10px;
  background:#8b0000;
  color:#fff;
  border:none;
  border-radius:6px;
  cursor:pointer;
  font-size:12px;
  flex:0 0 auto;
}
.value-pair-row .delete-btn:hover{
  background:#a00000;
}
.add-value-btn{
  padding:6px 12px;
  background:#22c55e;
  color:#fff;
  border:none;
  border-radius:6px;
  cursor:pointer;
  font-size:12px;
  font-weight:500;
  transition:background 0.2s ease;
}
.add-value-btn:hover{
  background:#16a34a;
}
.value-count-badge{
  display:inline-block;
  background:#22c55e;
  color:#fff;
  font-size:10px;
  padding:2px 6px;
  border-radius:10px;
  font-weight:600;
}

/* Profile Container & Icon */
.profile-container {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: 8px;
}

.profile-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--panel);
  color: var(--muted);
  border: 1px solid #2a2a33;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.profile-icon:hover {
  background: #1a1a20;
  border-color: #3a3a42;
  color: var(--text);
}

.profile-icon.authenticated {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.profile-icon.authenticated:hover {
  background: #c81840;
}

.profile-icon svg {
  width: 18px;
  height: 18px;
}

/* Profile Dropdown */
.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 280px;
  background: var(--panel);
  border: 1px solid #2a2a33;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  border-radius: 12px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 300;
  overflow: hidden;
}

.profile-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Auth Options */
.auth-options {
  padding: 1.25rem;
}

.login-form {
  padding: 1.25rem;
}

.login-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  margin-bottom: 0.75rem;
}

.auth-subtitle {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  margin-bottom: 1rem;
  line-height: 1.4;
}

/* Auth Buttons */
.auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1px solid #2a2a33;
  border-radius: 8px;
  background: #1a1a20;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 0.5rem;
}

.auth-btn:hover {
  background: #22222a;
  border-color: #3a3a42;
}

.auth-btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.auth-btn.primary:hover {
  background: #c81840;
}

.auth-btn.google {
  background: #1a1a20;
  border: 1px solid #2a2a33;
}

.auth-btn.google:hover {
  background: #22222a;
  border-color: #3a3a42;
}

.auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Auth Divider */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 1rem 0;
  color: var(--muted);
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #2a2a33;
}

.auth-divider span {
  padding: 0 0.75rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Auth Form */
.auth-form-group {
  margin-bottom: 0.75rem;
}

.auth-form-group input {
  width: 100%;
  padding: 0.7rem;
  border: 1px solid #2a2a33;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text);
  background: #121216;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.auth-form-group input:focus {
  outline: none;
  border-color: var(--accent);
}

.auth-form-group input::placeholder {
  color: #666;
}

/* Auth Messages */
.auth-message {
  margin-top: 0.75rem;
  padding: 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  text-align: center;
  display: none;
}

.auth-message.success {
  display: block;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #22c55e;
}

.auth-message.error {
  display: block;
  background: rgba(220, 53, 69, 0.15);
  border: 1px solid rgba(220, 53, 69, 0.3);
  color: #dc3545;
}

/* Auth Loading */
.auth-loading {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.auth-loading.active {
  display: flex;
}

.auth-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #2a2a33;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: auth-spin 1s linear infinite;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

/* Auth Footer & Back Link */
.auth-footer {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #2a2a33;
  text-align: center;
}

.auth-footer span {
  font-size: 0.8rem;
  color: var(--muted);
}

.auth-footer a {
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
}

.auth-footer a:hover {
  text-decoration: underline;
}

.auth-back-link {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.6rem;
  background: none;
  border: 1px solid #2a2a33;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-back-link:hover {
  background: #1a1a20;
  color: var(--text);
}

/* Profile Info (Authenticated State) */
.profile-info {
  padding: 1.25rem;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #2a2a33;
}

.profile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.1rem;
  flex-shrink: 0;
  overflow: hidden;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-details h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.profile-details p {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.15rem 0 0 0;
}

/* Profile Actions */
.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.profile-action {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: none;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.profile-action:hover {
  background: #1a1a20;
  color: var(--accent-2);
}

.profile-action.billing {
  text-decoration: none;
  color: var(--muted);
}

.profile-action.billing:hover {
  background: #1a1a20;
  color: var(--accent-2);
}

.profile-action.logout {
  color: var(--accent);
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid #2a2a33;
}

.profile-action.logout:hover {
  background: rgba(225, 29, 72, 0.1);
}

/* Password Reset Modal */
.reset-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.reset-modal.active {
  display: flex;
  opacity: 1;
}

.reset-modal-content {
  background: var(--panel);
  border: 1px solid #2a2a33;
  border-radius: 12px;
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.reset-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: #1a1a20;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.2s ease;
}

.reset-modal-close:hover {
  background: #22222a;
  color: var(--text);
}

.reset-modal-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.reset-modal-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.5rem 0;
}

.reset-modal-header p {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

/* ===== Image Modal (Lightbox) ===== */
.image-modal {
  z-index: 300;
}

.image-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(8px);
}

.image-modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 95vw;
  max-width: 1200px;
  height: 90vh;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

.image-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(26, 26, 31, 0.95) 0%, var(--panel) 100%);
  flex-shrink: 0;
}

.image-modal-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.image-modal-close {
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-modal-close:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text);
}

/* Image Viewer Area */
.image-viewer {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 0;
  overflow: hidden;
  padding: 20px;
  background: rgba(0, 0, 0, 0.2);
}

.image-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-container img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  opacity: 1;
  transition: opacity 0.2s ease, transform 0.1s ease;
  cursor: grab;
  transform-origin: center center;
  user-select: none;
}

.image-container img.loading {
  opacity: 0;
}

.image-container img.dragging {
  cursor: grabbing;
  transition: none;
}

.image-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
}

.image-loading.active {
  display: block;
}

/* Zoom Controls */
.image-zoom-controls {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.75);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 20;
  backdrop-filter: blur(8px);
}

.zoom-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.zoom-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.zoom-btn:active {
  background: rgba(255, 255, 255, 0.35);
}

.zoom-level {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  min-width: 50px;
  text-align: center;
}

.image-empty {
  text-align: center;
  color: var(--muted);
  padding: 40px;
}

.image-empty .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.image-empty p {
  margin: 0 0 8px 0;
  font-size: 16px;
  color: var(--text);
}

.image-empty span {
  font-size: 13px;
  opacity: 0.7;
}

/* Navigation Arrows */
.image-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: var(--text);
  font-size: 28px;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
}

.image-nav:hover {
  background: var(--accent);
  border-color: var(--accent);
  opacity: 1;
}

.image-nav:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

.image-nav:disabled:hover {
  background: rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.1);
}

.image-nav.prev {
  left: 20px;
}

.image-nav.next {
  right: 20px;
}

/* Thumbnail Strip */
.image-thumbnails {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  overflow-x: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
  min-height: 84px;
}

.image-thumbnails:empty {
  display: none;
}

.image-thumb {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  object-fit: cover;
  flex-shrink: 0;
  opacity: 0.7;
}

.image-thumb:hover {
  border-color: rgba(34, 211, 238, 0.5);
  opacity: 1;
}

.image-thumb.active {
  border-color: var(--accent-2);
  opacity: 1;
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.3);
}

.image-thumb.dragging {
  opacity: 0.5;
  transform: scale(0.95);
}

/* Upload Area */
.image-upload-area {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  background: var(--panel);
  transition: background 0.2s ease;
}

.image-upload-area.drag-over {
  background: rgba(34, 211, 238, 0.08);
}

.image-upload-area .btn {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.upload-hint {
  font-size: 12px;
  color: var(--muted);
}

.upload-progress {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.upload-progress-bar {
  height: 100%;
  background: var(--accent-2);
  width: 0%;
  transition: width 0.3s ease;
}

/* Actions Bar */
.image-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.image-counter {
  font-size: 13px;
  color: var(--muted);
}

.btn.danger {
  color: #ef4444;
}

.btn.danger:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* ========================================
   SHARE MODAL STYLES
   ======================================== */

.share-modal-content {
  max-height: 80vh;
  overflow-y: auto;
}

.share-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.share-modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.share-section {
  margin-bottom: 24px;
}

.share-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-weight: 500;
}

.share-section-icon {
  font-size: 16px;
}

.share-section-title {
  font-size: 14px;
  color: var(--fg);
}

.share-link-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.share-link-input {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  font-size: 13px;
  font-family: monospace;
}

.share-link-input::placeholder {
  color: var(--muted);
  font-family: inherit;
}

.share-btn {
  padding: 8px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.share-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* Collaborators List */
.collaborators-list {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.collaborators-empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.collaborator-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.collaborator-item:last-child {
  border-bottom: none;
}

.collaborator-item.pending {
  opacity: 0.7;
}

.collaborator-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.collaborator-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.collaborator-avatar-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.collaborator-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.collaborator-name {
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collaborator-email {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collaborator-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.collaborator-permission {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.collaborator-permission.view {
  background: rgba(34, 211, 238, 0.15);
  color: #22d3ee;
}

.collaborator-permission.edit {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.collaborator-permission.admin {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}

.collaborator-remove {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.collaborator-remove:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* Add Collaborator Form */
.add-collaborator-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.invite-email-input {
  flex: 1;
  min-width: 180px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  font-size: 14px;
}

.invite-email-input::placeholder {
  color: var(--muted);
}

.invite-email-input:focus {
  outline: none;
  border-color: var(--accent);
}

.invite-permission-select {
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  font-size: 14px;
  cursor: pointer;
}

.invite-permission-select:focus {
  outline: none;
  border-color: var(--accent);
}

.btn.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
