/* PwdSafe — icon-driven, centered layout in the spirit of the original app,
   kept in a steel-and-brass palette with a rounded geometric typeface. Self-hosted. */

:root {
	--ink:      #14171c;
	--panel:    #1c2027;
	--panel-2:  #232833;
	--line:     #37404e;
	--line-2:   #4a5468;

	--text:     #eef0f4;
	--muted:    #aab0bd;
	--faint:    #767d8b;

	--brass:    #d7a95a;
	--brass-hi: #ecc079;
	--brass-dim:#3a3020;

	--mint:     #86dcac;
	--danger:   #e77373;

	--ui: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN",
	      "Avenir Next", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
	margin: 0;
	background: var(--ink);
	color: var(--text);
	font-family: var(--ui);
	font-size: 16px;
	line-height: 1.45;
	-webkit-font-smoothing: antialiased;
}

.page { min-height: 100vh; display: flex; flex-direction: column; }
.wrap { width: 100%; max-width: 780px; margin: 0 auto; padding: 34px 20px 80px; }

/* ---- Brand + breadcrumb ------------------------------------------------ */

.brandbar { display: flex; align-items: center; justify-content: center; gap: 14px; }
.wordmark { font-size: clamp(2rem, 6vw, 2.7rem); font-weight: 300; letter-spacing: 0.01em; }

.crumbs {
	text-align: center; color: var(--muted); margin-top: 6px; font-size: 1.02rem;
	display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}
.crumbs a { color: var(--muted); cursor: pointer; }
.crumbs a:hover { color: var(--brass); }
.crumbs .pipe { color: var(--line-2); }
.crumbs .here { color: var(--text); }

/* ---- Circular icon buttons -------------------------------------------- */

.ibtn {
	flex: none;
	display: inline-flex; align-items: center; justify-content: center;
	width: 44px; height: 44px; padding: 0;
	border-radius: 50%;
	border: 1.5px solid var(--line);
	background: transparent;
	color: var(--text);
	cursor: pointer;
	transition: color .12s ease, border-color .12s ease, background .12s ease, transform .06s ease;
}
.ibtn:hover:not(:disabled) { border-color: var(--brass); color: var(--brass); }
.ibtn:active:not(:disabled) { transform: scale(0.94); }
.ibtn:focus-visible { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px rgba(215,169,90,0.22); }
.ibtn:disabled { opacity: 0.4; cursor: default; }
.ibtn.sm { width: 38px; height: 38px; }
.ibtn.lg { width: 52px; height: 52px; }
.ibtn.on { color: var(--brass); border-color: var(--brass); }
.ibtn.danger:hover { color: var(--danger); border-color: var(--danger); }

.icon { width: 21px; height: 21px; }
.ibtn.sm .icon { width: 18px; height: 18px; }
.ibtn.lg .icon { width: 25px; height: 25px; }

/* ---- Pill inputs ------------------------------------------------------- */

.pill {
	width: 100%;
	padding: 12px 22px;
	background: var(--panel-2);
	border: 1.5px solid var(--line);
	border-radius: 999px;
	color: var(--text);
	font-family: var(--ui); font-size: 1rem;
	text-align: center;
}
.pill::placeholder { color: var(--faint); }
.pill:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px rgba(215,169,90,0.18); }

/* ---- Search / add cluster (centered) ---------------------------------- */

.center-col { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 26px; }
.searchrow { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 440px; }
.searchrow .pill { flex: 1; }

.addstack { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; max-width: 440px; }
.addstack .pill { width: 100%; }
.act-row { display: flex; gap: 14px; justify-content: center; }

/* ---- Entry rows -------------------------------------------------------- */

.rows { margin-top: 30px; display: flex; flex-direction: column; gap: 4px; }

.row {
	display: grid;
	grid-template-columns: 44px minmax(120px, 260px) 1fr auto;
	align-items: center;
	gap: 16px;
	padding: 6px 2px;
	-webkit-user-select: none; user-select: none; /* no text-selection artifacts while dragging */
}

.row-name {
	font-size: 1.06rem; color: var(--text); cursor: pointer;
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
	display: inline-flex; align-items: baseline; gap: 8px;
}
.row-name:hover { color: var(--brass); }
.row-name .cnt { color: var(--faint); font-size: 0.82rem; }

.row-val { color: var(--faint); letter-spacing: 2px; min-width: 0; overflow-wrap: anywhere; }
.row-val.shown {
	color: var(--brass-hi); letter-spacing: 0; cursor: pointer;
	-webkit-user-select: none; user-select: none; /* don't text-select on double-click */
}
.row-val.shown:hover { color: var(--brass); }
.row-val.copied { animation: copyflash 0.5s ease; }

@keyframes copyflash {
	0%   { color: var(--brass-hi); text-shadow: none; }
	15%  { color: #ffffff; text-shadow: 0 0 14px rgba(215,169,90,0.9); }
	35%  { opacity: 0.15; }
	60%  { color: #ffffff; opacity: 1; text-shadow: 0 0 14px rgba(215,169,90,0.9); }
	100% { color: var(--brass-hi); text-shadow: none; }
}

.row-acts { display: flex; gap: 10px; justify-content: flex-end; }

/* Edit mode: inline flex so the two fields sit exactly where name + value are. */
.row.editing { display: flex !important; flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 12px; }
.row.editing > .lock, .row.editing > .row-acts { flex: 0 0 auto; }
.row.editing > .pill { flex: 1 1 0; width: auto; min-width: 40px; padding: 9px 18px; text-align: left; }

/* Drag & drop reorder (desktop) */
.row[draggable="true"] { cursor: grab; }
.row[draggable="true"]:active { cursor: grabbing; }
.row.dragging { opacity: 0.35; }

/* Placeholder gap that opens between rows at the drop position (jQuery-sortable style). */
.drop-slot {
	height: 42px;
	margin: 2px 0;
	border: 1.5px dashed var(--brass);
	border-radius: 10px;
	background: rgba(215,169,90,0.08);
}

/* ---- Auth screens ------------------------------------------------------ */

.auth { max-width: 380px; margin: 10vh auto 0; text-align: center; }
.auth .wordmark { display: block; margin-bottom: 4px; }
.auth-sub { color: var(--muted); margin: 0 0 26px; }
.auth .field { margin: 12px 0; }

/* Reveal toggle inside the master-password pill; symmetric padding keeps the text centered. */
.pw-field { position: relative; }
.pw-field .pill { padding-left: 48px; padding-right: 48px; }
.pw-toggle {
	position: absolute; top: 50%; right: 16px; transform: translateY(-50%);
	background: none; border: none; padding: 4px; cursor: pointer;
	color: var(--faint); display: flex; align-items: center;
}
.pw-toggle:hover { color: var(--brass); }
.auth .pill { text-align: center; }

.btn-pill {
	appearance: none;
	font-family: var(--ui); font-size: 1rem; font-weight: 500;
	padding: 12px 30px; border-radius: 999px; cursor: pointer;
	background: var(--brass); border: 1.5px solid var(--brass); color: #241a08;
	transition: background .12s ease, border-color .12s ease, opacity .12s ease;
}
.btn-pill:hover:not(:disabled) { background: var(--brass-hi); border-color: var(--brass-hi); }
.btn-pill.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-pill.ghost:hover:not(:disabled) { border-color: var(--brass); color: var(--brass); }
.btn-pill:disabled { opacity: 0.45; cursor: default; }

.linkbtn { background: none; border: none; color: var(--brass); cursor: pointer; font: inherit; padding: 8px; }
.linkbtn:hover { color: var(--brass-hi); }

.enroll-step { padding: 20px 0; border-top: 1px solid var(--line); }
.enroll-step:first-of-type { border-top: none; }
.step-h { font-size: 0.8rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.secret { display: inline-block; margin: 8px 0; padding: 8px 16px; border: 1.5px solid var(--line); border-radius: 999px; color: var(--brass-hi); letter-spacing: 2px; }

.msg-error { color: var(--danger); margin-top: 14px; }
.msg-ok { color: var(--mint); }
.muted { color: var(--muted); }
.empty { color: var(--faint); text-align: center; margin-top: 34px; }

/* ---- Responsive -------------------------------------------------------- */

@media (max-width: 560px) {
	.wrap { padding: 26px 16px 72px; }
	.rows { gap: 12px; margin-top: 24px; }
	.row {
		grid-template-columns: 44px 1fr auto;
		grid-template-areas: "lock name acts" "lock val acts";
		column-gap: 14px; row-gap: 3px;
		align-items: center; padding: 4px 0;
	}
	.row .lock  { grid-area: lock; align-self: center; }
	.row-name   { grid-area: name; }
	.row-val    { grid-area: val; }
	.row-acts   { grid-area: acts; align-self: center; }

	/* Edit row stays inline flex (from the base rule) even on mobile — no stacking. */

	.searchrow, .addstack { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; }
	.row-val.copied { animation: none; }
}
