:root { --bg:#0b0c0f; --card:#14161b; --text:#e8eaf0; --muted:#9aa3b2; --primary:#4f8cff; --error:#ff5263; }
*{box-sizing:border-box} body{margin:0;background:var(--bg);color:var(--text);font:14px/1.5 system-ui,Segoe UI,Roboto,Helvetica,Arial}
.ph-shell{padding:24px}
.ph-card{background:var(--card);border:1px solid #22252b;border-radius:10px;padding:18px;margin:16px 0;box-shadow:0 6px 20px rgba(0,0,0,.25)}
.ph-auth{max-width:420px;margin:48px auto}
.ph-tabs{display:flex;gap:8px;margin:8px 0 16px}
.ph-tab{background:#1a1d24;border:1px solid #2a2e36;color:var(--muted);padding:8px 12px;border-radius:8px;cursor:pointer}
.ph-tab.active{color:var(--text);border-color:var(--primary)}
.ph-pane{display:none}.ph-pane.active{display:block}
.ph-form{display:flex;flex-direction:column;gap:10px;margin-top:8px}
.ph-form.inline{flex-direction:row;flex-wrap:wrap;align-items:flex-end}
label{display:flex;flex-direction:column;gap:6px;color:var(--muted)}
input,select{background:#0f1115;border:1px solid #2a2e36;color:var(--text);padding:10px;border-radius:8px;outline:none}
.ph-btn{background:#1b1f27;border:1px solid #2a2e36;color:var(--text);padding:10px 14px;border-radius:8px;cursor:pointer}
.ph-btn.primary{background:var(--primary);border-color:transparent;color:#fff}
.ph-msg{margin-top:8px;color:var(--muted)} .ph-msg.error{color:var(--error)}
.ph-help{margin-top:16px;color:var(--muted);text-align:center}
.ph-topbar{display:flex;justify-content:space-between;align-items:center;padding:8px 12px;background:#0f1115;border:1px solid #23262d;border-radius:10px;position:sticky;top:8px}
.brand{font-weight:700}
.ph-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:16px;margin-top:16px}
.ph-kv{display:grid;grid-template-columns:160px 1fr;gap:6px 12px;margin-bottom:10px}
.ph-kv span{color:var(--muted)}
.ph-table{width:100%;border-collapse:collapse;margin-top:10px}
.ph-table th,.ph-table td{border-bottom:1px solid #242830;padding:8px;text-align:left}
.ph-table a{color:var(--primary);text-decoration:none}
.ph-toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);background:#111418;color:#fff;padding:10px 14px;border-radius:8px;border:1px solid #2a2e36;opacity:0;pointer-events:none;transition:opacity .2s ease}
.ph-toast.show{opacity:1}
.ph-controls{display:flex;gap:8px;align-items:center;margin:8px 0}
.ph-select{background:#0f1115;border:1px solid #2a2e36;color:var(--text);padding:8px;border-radius:8px}
.ph-btn.small{padding:6px 10px;font-size:12px}
.ph-empty{color:var(--muted);padding:8px}

/* Clamp table layout and truncate long cells */
.ph-card{overflow:hidden}
.ph-table{table-layout:fixed;width:100%}
.ph-table th,.ph-table td{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* Galleries table column widths - favor Share and Price columns */
#galleriesTable th:nth-child(1),#galleriesTable td:nth-child(1){width:20%}
#galleriesTable th:nth-child(2),#galleriesTable td:nth-child(2){width:14%}
#galleriesTable th:nth-child(3),#galleriesTable td:nth-child(3){width:46%}
#galleriesTable th:nth-child(4),#galleriesTable td:nth-child(4){width:20%}

/* Let the Share Link column wrap and show inline buttons */
#galleriesTable td:nth-child(4){white-space:normal}
#galleriesTable td:nth-child(4) .truncate{max-width:60%;display:inline-block;vertical-align:middle}
.btn-inline{display:inline-block;margin-left:6px}
.
/* Manage column */
.gal-manage{white-space:nowrap;overflow:visible}
.gal-manage .ph-btn{min-width:72px;text-align:center}

/* Orders table column widths */
#ordersTable th:nth-child(1),#ordersTable td:nth-child(1){width:38%}
#ordersTable th:nth-child(2),#ordersTable td:nth-child(2){width:18%}
#ordersTable th:nth-child(3),#ordersTable td:nth-child(3){width:14%}
#ordersTable th:nth-child(4),#ordersTable td:nth-child(4){width:20%}
#ordersTable th:nth-child(5),#ordersTable td:nth-child(5){width:10%}

/* Truncate utility */
.truncate{display:inline-block;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

@media (max-width:640px){.ph-kv{grid-template-columns:120px 1fr}}
.table-wrap{overflow-x:auto}
.ph-table.galleries{table-layout:fixed;width:100%}
.ph-table.galleries th,.ph-table.galleries td{vertical-align:middle}
.galleries .col-id{width:20ch}
.galleries .col-created{width:18ch}
.galleries .col-share{width:auto;overflow:visible}
.cell-flex{display:flex;align-items:center;gap:6px;flex-wrap:wrap;min-width:0}
.cell-flex__link{flex:1 1 260px;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
@media (max-width:640px){.cell-flex__link{flex-basis:100%}}
@media (min-width:1024px){
  /* Make the Galleries card span full width on larger screens */
  #galleriesCard{grid-column:1 / -1}
  .cell-flex__link{flex-basis:70%}
}
/* Keep Galleries in normal flow (just after Profile) */
@media (orientation:landscape) and (min-width:1024px){
  #galleriesCard{grid-row: auto}
}
/* Compact small buttons to reduce overflow */
.ph-btn.small{padding:5px 8px;font-size:12px;line-height:1}
input.ph-input.small{padding:8px 10px}

.ph-topbar__actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.ph-menu-toggle{display:none;align-items:center;gap:8px}
@media (max-width:640px){
  .ph-menu-toggle{display:inline-flex}
  .ph-topbar{position:sticky;top:0;z-index:60;border-radius:0;border-bottom:1px solid #23262d}
  .ph-topbar__actions{
    display:none;
    position:absolute;left:8px;right:8px;top:calc(100% + 6px);
    background:#0f1115;border:1px solid #23262d;border-radius:10px;
    padding:10px;flex-direction:column;gap:8px;box-shadow:0 10px 24px rgba(0,0,0,.35)
  }
  .ph-topbar.is-open .ph-topbar__actions{display:flex}
  .ph-topbar__actions > *{width:100%}
  .ph-auth-status{white-space:normal}
}
.ph-auth-status{color:var(--muted);font-size:14px}
.ph-btn.link{background:none;border:none;color:var(--primary);text-decoration:underline;padding:0;cursor:pointer}
.ph-btn.link:hover{color:#9dbfff}
.ph-card--signin{text-align:center;display:flex;flex-direction:column;gap:12px;align-items:center;justify-content:center}
.ph-toast-container{position:fixed;top:16px;right:16px;display:flex;flex-direction:column;gap:8px;z-index:200}
.ph-toast-container .toast{background:#111418;border:1px solid #2a2e36;color:#fff;padding:10px 14px;border-radius:10px;font-size:14px;opacity:1;transform:translateY(0);transition:opacity .3s ease,transform .3s ease;min-width:220px;max-width:320px}
.ph-toast-container .toast--success{background:#1f9d55}
.ph-toast-container .toast--error{background:#ff5263}
.ph-toast-container .toast--info{background:#4f8cff}
.ph-toast-container .toast--hide{opacity:0;transform:translateY(-6px)}
.support-actions{display:flex;gap:12px;flex-wrap:wrap}
.ph-hint{color:var(--muted);font-size:13px}
.support-details{background:#10131a;border:1px solid #2a2e36;border-radius:8px;padding:10px;margin-top:10px}
