:root {
	--surface: #1f1f1f;
	--surface-2: #2b2b2b;
	--accent: #0078d4;
	--accent-2: #005a9e;
	--text: #f3f3f3;
	--text-muted: #a8b3bf;
	--line: #363636;
	--danger: #ef5350;
	--success: #4caf50;
	--control-height: 32px;
	--value-font: Menlo, Monaco, 'Courier New', monospace;
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	min-height: 100%;
}

body {
	background: #1f1f1f;
	color: var(--text);
	font-family: 'Pretendard', 'Noto Sans KR', 'Segoe UI', 'Apple SD Gothic Neo', Arial, sans-serif;
	font-size: 13px;
}

body.auth-active {
	min-height: 100vh;
	display: grid;
	place-items: center;
}

body.auth-active .app-shell {
	display: grid;
	place-items: center;
	width: min(100%, 560px);
	margin: 0;
	padding: 0 16px;
}

h1,
h2 {
	margin: 0;
}

input,
textarea,
select,
button {
	font: inherit;
	color: var(--text);
	background: #242424;
	border: 1px solid var(--line);
	border-radius: 0;
	padding: 0 10px;
	height: var(--control-height);
	line-height: 1;
}

input,
textarea,
select {
	width: 100%;
	outline: none;
	font-family: var(--value-font);
}

select {
	width: 180px;
}

textarea {
	min-height: 72px;
	resize: vertical;
	padding: 6px 10px;
}

textarea#contentInput,
textarea#memoInput {
	font-family: var(--value-font);
}

textarea#contentInput {
	height: 150px;
	line-height: 1.2;
}

input[type='checkbox'],
textarea#memoInput {
	height: auto;
}

input:focus,
textarea:focus,
select:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.2);
}

button {
	cursor: pointer;
	background: transparent;
	border-color: var(--line);
	color: #b3b3b3;
	transition: background 0.2s ease;
	font-weight: 600;
}

button:hover {
	background: #2c2c2c;
	color: #b3b3b3;
}

button:active {
	transform: translateY(1px);
}

button.ghost {
	background: transparent;
	border-color: var(--line);
	color: #b3b3b3;
}

.button-like {
	height: 28px;
	min-height: 28px;
	line-height: 1;
	padding: 0 10px;
	border: 1px solid var(--line);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #b3b3b3;
	text-decoration: none;
	cursor: pointer;
	background: transparent;
}

button:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.app-shell {
	width: 100%;
	max-width: 1800px;
	margin: 0 auto;
	padding: 0;
	display: grid;
	gap: 0;
}

.panel {
	background: transparent;
	border: none;
	padding: 14px;
}

.auth-panel {
	width: 320px;
	max-width: 320px;
	margin: 0 auto;
	padding-top: 0;
	padding-bottom: 0;
}

.auth-title,
.auth-subtitle {
	text-align: center;
}

.field {
	display: grid;
	gap: 6px;
	margin-bottom: 10px;
}

.field label {
	font-weight: 600;
	color: #b3b3b3;
}

.field small {
	color: var(--text-muted);
	font-size: 12px;
}

.auth-divider {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin: 16px 0;
	color: var(--text-muted);
}

.auth-divider::before,
.auth-divider::after {
	content: '';
	flex: 1;
	height: 1px;
	background: var(--line);
}

.auth-panel h3 {
	margin: 8px 0 6px;
}

.message {
	min-height: 20px;
	margin: 6px 0 0;
}

.message.ok {
	color: var(--success);
}

.message.error {
	color: var(--danger);
}

.field-help {
	min-height: 18px;
	font-size: 11px;
	color: var(--text-muted);
}

.field-help.error {
	color: var(--danger);
}

.field input.input-invalid,
.field textarea.input-invalid {
	border-color: var(--danger);
	box-shadow: 0 0 0 1px rgba(239, 83, 80, 0.2);
}

.muted {
	color: var(--text-muted);
	margin: 4px 0 0;
}

.hidden {
	display: none;
}

.top-bar {
	display: flex;
	gap: 12px;
	justify-content: space-between;
	align-items: center;
	height: 40px;
	min-height: 40px;
	border-bottom: 1px solid var(--line);
	padding: 0 10px;
}

.top-bar .top-meta {
	min-width: 0;
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	min-height: 40px;
}

.top-bar .top-meta h2 {
	margin: 0;
	font-size: 14px;
	line-height: 1;
}

.status-line {
	display: flex;
	gap: 4px;
	align-items: center;
	flex-wrap: wrap;
}

.status-line .status-chip {
	height: 20px;
	padding: 0 6px;
	font-size: 11px;
}

.status-chip {
	display: inline-flex;
	align-items: center;
	height: 20px;
	border: 1px solid var(--line);
	border-radius: 0;
	padding: 0 8px;
	font-size: 12px;
	background: #232a33;
	color: #b3b3b3;
	white-space: nowrap;
}

.status-chip:empty {
	display: none;
}

.status-chip.status-id {
	color: #b3b3b3;
}

.status-chip.status-state {
	color: #b3b3b3;
}

.status-chip.status-sync {
	color: #b3b3b3;
}

.status-text {
	color: #b3b3b3;
	font-size: 12px;
	white-space: nowrap;
}

.status-text.ok,
.status-text.error {
	color: #b3b3b3;
}

.status-chip.ok {
	color: #e8fff0;
	border-color: var(--success);
	background: rgba(76, 175, 80, 0.16);
}

.status-chip.error {
	color: #ffd4d3;
	border-color: var(--danger);
	background: rgba(239, 83, 80, 0.18);
}

.top-bar .actions {
	display: flex;
	gap: 0;
	min-height: 40px;
	align-items: center;
}

.top-bar .actions button {
	height: 28px;
	min-height: 28px;
	line-height: 1;
	padding: 0 10px;
	border: none;
}

.top-bar .actions button + button {
	margin-left: 6px;
}

.toolbar {
	display: flex;
	gap: 8px;
	align-items: center;
	padding: 12px 14px 10px;
	border-bottom: 1px solid var(--line);
	margin-bottom: 0;
}

.toolbar input {
	flex: 1;
}

.workspace-main {
	display: grid;
	grid-template-columns: 1fr minmax(0, 400px);
	justify-content: center;
	gap: 0;
}

#listSection {
	border-right: 1px solid var(--line);
	padding: 0;
}

#editSection {
	max-width: 400px;
}

@media (min-width: 900px) {
	#listSection.hidden,
	#editSection.hidden {
		display: block;
	}
}

.list-scroll {
	border-left: 0;
	border-right: 0;
	min-height: 360px;
	max-height: 560px;
	overflow: auto;
	padding: 0;
	background: transparent;
}

.secret-item {
	width: 100%;
	background: transparent;
	cursor: pointer;
	border-bottom: 1px solid var(--line);
	height: 30px;
}

.secret-table {
	width: 100%;
	border-collapse: collapse;
	table-layout: auto;
	font-family: var(--value-font);
}

.secret-table th,
.secret-table td {
	text-align: left;
	padding: 5px 8px;
	vertical-align: middle;
	color: var(--text);
	height: 30px;
	max-height: 30px;
}

.secret-table th {
	color: #b3b3b3;
	font-weight: 600;
	font-size: 11px;
	height: 30px;
	padding: 0 8px;
	border-bottom: 1px solid var(--line);
	vertical-align: middle;
}

.secret-table th.is-sortable {
	cursor: pointer;
	user-select: none;
}

.secret-table th.is-sortable:hover {
	color: var(--text);
}

.secret-table tr:last-child {
	border-bottom: 0;
}

.secret-item:last-child {
	border-bottom: none;
}

.secret-item .title {
	font-weight: 700;
	color: #fff;
	margin-bottom: 2px;
}

.secret-item .meta {
	margin-top: 4px;
	color: var(--text-muted);
	font-size: 13px;
}

.secret-item:hover,
.secret-item:focus-visible {
	background: #262626;
}

.secret-item[data-active='true'] {
	background: #2a2a2a;
}

.secret-identity {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.secret-icon-wrap {
	width: 16px;
	height: 16px;
	min-width: 16px;
	min-height: 16px;
	max-width: 16px;
	max-height: 16px;
	aspect-ratio: 1 / 1;
	border-radius: 0;
	overflow: hidden;
	flex: 0 0 16px;
	display: grid;
	place-items: center;
}

.secret-icon-img {
	width: 16px;
	height: 16px;
	min-width: 16px;
	min-height: 16px;
	max-width: 16px;
	max-height: 16px;
	aspect-ratio: 1 / 1;
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	object-position: center;
	display: block;
}

.secret-icon-column,
.secret-icon-cell {
	width: 28px;
	min-width: 28px;
	max-width: 28px;
	text-align: center;
	padding-left: 4px;
	padding-right: 4px;
	white-space: nowrap;
}

.secret-icon-fallback,
.secret-icon-wrap.text-fallback {
	width: 16px;
	height: 16px;
	min-width: 16px;
	min-height: 16px;
	max-width: 16px;
	max-height: 16px;
	aspect-ratio: 1 / 1;
	color: #cfd6df;
	font-size: 11px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-transform: uppercase;
}

.secret-title-wrap .meta {
	font-size: 12px;
	font-size: 13px;
}

.inline2 {
	display: grid;
	gap: 10px;
	grid-template-columns: 1fr 1fr;
}

.editor-actions {
	display: flex;
	gap: 10px;
	margin-top: 10px;
}

.settings-shell {
	margin: 14px auto;
	padding: 0 12px;
	width: min(100%, 760px);
}

.settings-topbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 10px;
	margin-bottom: 8px;
}

.settings-topbar h2 {
	margin: 0;
	font-size: 20px;
}

.settings-form {
	display: grid;
	gap: 10px;
}

.settings-group {
	display: grid;
	gap: 10px;
	border-top: 1px dashed var(--line);
	padding-top: 10px;
}

.settings-group:first-of-type {
	border-top: 0;
	padding-top: 0;
}

.settings-row-actions {
	display: flex;
	gap: 10px;
}

.settings-row-actions button {
	flex: 1;
}

.settings-combo-row {
	display: grid;
	gap: 8px;
	grid-template-columns: 1fr auto auto;
	align-items: center;
}

.settings-shell h3 {
	margin: 12px 0 0;
	font-size: 14px;
}

.settings-shell .muted {
	margin-top: 0;
	margin-bottom: 0;
}

.settings-shell .field {
	margin-bottom: 0;
}

.editor-actions button {
	flex: 1;
}

.status-bar {
	margin-top: 12px;
	display: none;
}

.value-only {
	font-family: var(--value-font);
}

@media (max-width: 900px) {
	.app-shell {
		margin: 12px auto;
		padding: 0 12px 16px;
	}

	.workspace-main {
		grid-template-columns: 1fr;
	}

	.list-scroll {
		max-height: none;
	}

	.top-bar {
		display: grid;
		gap: 8px;
	}

	.top-bar .actions {
		width: 100%;
		display: grid;
		grid-template-columns: 1fr;
	}

	.inline2 {
		grid-template-columns: 1fr;
	}

	.toolbar {
		display: grid;
		grid-template-columns: 1fr;
	}

	.toolbar button,
	.toolbar select,
	.toolbar input {
		width: 100%;
	}
}

@media (max-width: 900px) {
	body.auth-active .app-shell {
		width: min(100%, 460px);
		padding: 0 12px;
	}
}

@media (max-width: 420px) {
	.top-bar .actions button {
		flex: 1;
	}
}
